Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2015-06-07 09:08:19 -0400
committerEd Willink2015-06-07 12:47:06 -0400
commitb21a01d796c926624a9b7f7948c9744a039add4c (patch)
treef82d8a9b3b9bb9ff2d3e8b102b4090e997e69a23
parentbf8ebaaad5666d93c8190214ae1624fc10ae44ea (diff)
downloadorg.eclipse.qvtd-b21a01d796c926624a9b7f7948c9744a039add4c.tar.gz
org.eclipse.qvtd-b21a01d796c926624a9b7f7948c9744a039add4c.tar.xz
org.eclipse.qvtd-b21a01d796c926624a9b7f7948c9744a039add4c.zip
[469560] Add a Run launch test and Plugin testing
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/launching/QVTiLaunchConstants.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiModelManager.java6
-rw-r--r--releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-buckminster.script3
-rw-r--r--releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-tests-buckminster.script3
-rw-r--r--tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (Plugin).launch41
-rw-r--r--tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (standalone).launch (renamed from tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests.launch)32
-rw-r--r--tests/org.eclipse.qvtd.all.tests/META-INF/MANIFEST.MF2
-rw-r--r--tests/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java21
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/LoadTests.java19
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcDomainUsageTests.java3
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcSerializeTests.java3
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/META-INF/MANIFEST.MF4
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/AllQVTimperativeTests.java10
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiDebuggerTests.java96
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiEditorTests.java19
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiSerializeTests.java3
16 files changed, 231 insertions, 36 deletions
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/launching/QVTiLaunchConstants.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/launching/QVTiLaunchConstants.java
index 182798ad7..39e1a4d2a 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/launching/QVTiLaunchConstants.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/launching/QVTiLaunchConstants.java
@@ -17,6 +17,8 @@ import org.eclipse.jdt.annotation.NonNull;
public interface QVTiLaunchConstants
{
+ static final @NonNull String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.qvtd.debug.launching.QVTiLaunchConfigurationDelegate";
+
public static final @NonNull Map<String, String> EMPTY_MAP = new HashMap<String,String>();
/**
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiModelManager.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiModelManager.java
index 47727fbc2..2e28b644c 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiModelManager.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiModelManager.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.PivotPackage;
@@ -34,6 +35,7 @@ import org.eclipse.ocl.pivot.ids.IdResolver;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.MetamodelManager;
import org.eclipse.ocl.pivot.utilities.ParserException;
+import org.eclipse.ocl.pivot.utilities.XMIUtil;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.evaluation.TransformationInstance;
@@ -265,7 +267,9 @@ public class QVTiModelManager implements ModelManager
* Saves all the models managed by the domain manager
*/
public void saveModels() {
- this.saveModels(null);
+ Map<Object, Object> saveOptions = XMIUtil.createSaveOptions();
+ saveOptions.put(XMIResource.OPTION_SCHEMA_LOCATION_IMPLEMENTATION, Boolean.TRUE);
+ this.saveModels(saveOptions);
}
/**
* Saves all the models managed by the domain manager using the provided (optional)
diff --git a/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-buckminster.script b/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-buckminster.script
index f21b3ed95..b1726bdfa 100644
--- a/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-buckminster.script
+++ b/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-buckminster.script
@@ -11,7 +11,8 @@ import --properties "${checkout.location}/buildroot/build.properties" "org.eclip
build
-junit --launch "org.eclipse.qvtd.all.tests/.launches/All\ QVTd\ Tests.launch" --flatXML --output "${checkout.location}/MMT-QVTd.test.results/org.eclipse.qvtd.xtext.qvtd.all.xml"
+junit --launch "org.eclipse.qvtd.all.tests/.launches/All\ QVTd\ Tests\ \(standalone\).launch" --flatXML --output "${checkout.location}/MMT-QVTd.test.results/org.eclipse.qvtd.xtext.qvtd.all.xml"
+junit --launch "org.eclipse.qvtd.all.tests/.launches/All\ QVTd\ Tests\ \(Plugin\).launch" --flatXML --output "${checkout.location}/MMT-QVTd.test.results/org.eclipse.qvtd.xtext.qvtd.all.plugin.xml"
perform --properties "${checkout.location}/buildroot/build.properties" "-Dbuckminster.reference.repository=${reference.repository}" "org.eclipse.qvtd.releng.build:eclipse.feature#build"
perform --properties "${checkout.location}/buildroot/build.properties" "org.eclipse.qvtd.releng.buckminster:buckminster#setup.promoter"
diff --git a/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-tests-buckminster.script b/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-tests-buckminster.script
index 4ac935f24..a2bf286dc 100644
--- a/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-tests-buckminster.script
+++ b/releng/org.eclipse.qvtd.releng.buckminster/scripts/qvtd-tests-buckminster.script
@@ -11,7 +11,8 @@ import --properties "${checkout.location}/buildroot/build.properties" "org.eclip
build
-junit --launch "org.eclipse.qvtd.all.tests/.launches/All\ QVTd\ Tests.launch" --flatXML --output "${checkout.location}/MMT-QVTd.test.results/org.eclipse.qvtd.xtext.qvtd.all.xml"
+junit --launch "org.eclipse.qvtd.all.tests/.launches/All\ QVTd\ Tests\ \(standalone\).launch" --flatXML --output "${checkout.location}/MMT-QVTd.test.results/org.eclipse.qvtd.xtext.qvtd.all.xml"
+junit --launch "org.eclipse.qvtd.all.tests/.launches/All\ QVTd\ Tests\ \(Plugin\).launch" --flatXML --output "${checkout.location}/MMT-QVTd.test.results/org.eclipse.qvtd.xtext.qvtd.all.plugin.xml"
perform --properties "${checkout.location}/buildroot/build.properties" "-Dbuckminster.reference.repository=${reference.repository}" "org.eclipse.qvtd.releng.build:eclipse.feature#build"
perform --properties "${checkout.location}/buildroot/build.properties" "org.eclipse.qvtd.releng.buckminster:buckminster#setup.promoter"
diff --git a/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (Plugin).launch b/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (Plugin).launch
new file mode 100644
index 000000000..72c6784cb
--- /dev/null
+++ b/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (Plugin).launch
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.qvtd.all.tests.AllQVTdTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.qvtd.all.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx1024m -ea -XX:PermSize=128M -XX:MaxPermSize=192M"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests.launch b/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (standalone).launch
index 3a806ef79..3a3b9a76c 100644
--- a/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests.launch
+++ b/tests/org.eclipse.qvtd.all.tests/.launches/All QVTd Tests (standalone).launch
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.qvtd.all.tests.AllQVTdTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.qvtd.all.tests"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.qvtd.all.tests.AllQVTdTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.qvtd.all.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
+</launchConfiguration>
diff --git a/tests/org.eclipse.qvtd.all.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.qvtd.all.tests/META-INF/MANIFEST.MF
index 93cf271c0..dc7ec05a4 100644
--- a/tests/org.eclipse.qvtd.all.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.qvtd.all.tests/META-INF/MANIFEST.MF
@@ -6,6 +6,8 @@ Bundle-Version: 0.12.0.qualifier
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.pde.junit.runtime;bundle-version="[3.4.0,5.0.0)",
+ org.eclipse.ui.ide.application;bundle-version="[1.0.0,2.0.0)",
org.eclipse.ocl.xtext.completeocl;bundle-version="[1.0.0,1.1.0)",
org.eclipse.ocl.xtext.oclinecore;bundle-version="[1.0.0,1.1.0)",
org.eclipse.ocl.xtext.oclstdlib;bundle-version="[1.0.0,1.1.0)",
diff --git a/tests/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java b/tests/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java
index 9ef8f66c5..db7f37138 100644
--- a/tests/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java
+++ b/tests/org.eclipse.qvtd.all.tests/src/org/eclipse/qvtd/all/tests/AllQVTdTests.java
@@ -19,12 +19,14 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
+import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.qvtd.build.etl.tests.QVTdMtcTests;
import org.eclipse.qvtd.build.qvtrtoqvtc.tests.QvtrToQvtcTests;
import org.eclipse.qvtd.cs2as.compiler.tests.OCL2QVTiTestCases;
import org.eclipse.qvtd.xtext.qvtbase.tests.QVTbaseLibraryTests;
import org.eclipse.qvtd.xtext.qvtcore.tests.AllQVTcoreTests;
import org.eclipse.qvtd.xtext.qvtimperative.tests.AllQVTimperativeTests;
+import org.eclipse.qvtd.xtext.qvtimperative.tests.QVTiDebuggerTests;
import org.eclipse.qvtd.xtext.qvtrelation.tests.AllQVTrelationTests;
/**
@@ -41,12 +43,21 @@ public class AllQVTdTests extends TestCase
TestSuite result = new TestSuite("QVTd All Tests");
result.addTest(AllQVTcoreTests.suite());
result.addTest(AllQVTimperativeTests.suite());
- result.addTest(AllQVTrelationTests.suite());
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) { // FIXME should work as plugin test too
+ result.addTest(AllQVTrelationTests.suite());
+ }
result.addTestSuite(QVTbaseLibraryTests.class);
- result.addTestSuite(GrammarTests.class);
- result.addTestSuite(QVTdMtcTests.class);
- result.addTestSuite(QvtrToQvtcTests.class);
- result.addTestSuite(OCL2QVTiTestCases.class);
+ if (EMFPlugin.IS_ECLIPSE_RUNNING) {
+ result.addTestSuite(QVTiDebuggerTests.class);
+ }
+ else {
+ result.addTestSuite(GrammarTests.class); // *.xtextbin fail to load in Eclipse, but we don't need to test twice anyway.
+ }
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) { // FIXME should work as plugin test too
+ result.addTestSuite(QVTdMtcTests.class);
+ result.addTestSuite(QvtrToQvtcTests.class);
+ result.addTestSuite(OCL2QVTiTestCases.class);
+ }
return result;
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/LoadTests.java b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/LoadTests.java
index 6c52406e7..c9036109b 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/LoadTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/LoadTests.java
@@ -12,20 +12,37 @@ package org.eclipse.qvtd.xtext.qvtcore.tests;
import java.io.IOException;
+import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.ocl.xtext.base.services.BaseLinkingService;
import org.eclipse.qvtd.xtext.qvtbase.tests.LoadTestCase;
import org.eclipse.qvtd.xtext.qvtcore.QVTcoreStandaloneSetup;
+import com.google.inject.Guice;
+
/**
* Tests that load a model and verify that there are no unresolved proxies as a result.
*/
public class LoadTests extends LoadTestCase
{
+ /**
+ * Perform the appropriate initialization to support QVTcore parsing and editing using Xtext.
+ * NB. This must be called before setUp() creates a GlobalStateMemento if the aggressive DEBUG_GC
+ * garbage collection is enabled.
+ */
+ public static void doQVTcoreSetup() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ QVTcoreStandaloneSetup.doSetup();
+ }
+ else {
+ Guice.createInjector(new org.eclipse.qvtd.xtext.qvtcore.QVTcoreRuntimeModule());
+ }
+ }
+
@Override
protected void setUp() throws Exception {
BaseLinkingService.DEBUG_RETRY.setState(true);
+ doQVTcoreSetup();
super.setUp();
- QVTcoreStandaloneSetup.doSetup();
}
public void testLoad_expressions_qvtc() throws IOException, InterruptedException {
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcDomainUsageTests.java b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcDomainUsageTests.java
index afd402da9..46080f4fd 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcDomainUsageTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcDomainUsageTests.java
@@ -49,7 +49,6 @@ import org.eclipse.qvtd.pivot.qvtcorebase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtcorebase.analysis.DomainUsageAnalysis;
import org.eclipse.qvtd.xtext.qvtbase.tests.LoadTestCase;
import org.eclipse.qvtd.xtext.qvtbase.tests.utilities.TestsXMLUtil;
-import org.eclipse.qvtd.xtext.qvtcore.QVTcoreStandaloneSetup;
/**
* Tests that load a model and verify that there are no unresolved proxies as a result.
@@ -156,8 +155,8 @@ public class QVTcDomainUsageTests extends LoadTestCase
@Override
protected void setUp() throws Exception {
BaseLinkingService.DEBUG_RETRY.setState(true);
+ LoadTests.doQVTcoreSetup();
super.setUp();
- QVTcoreStandaloneSetup.doSetup();
}
public Resource doLoad_ConcreteWithOCL(@NonNull MyQVT myQVT, @NonNull URI inputURI) throws IOException {
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcSerializeTests.java b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcSerializeTests.java
index 291bf759d..e34c8f849 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcSerializeTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcSerializeTests.java
@@ -28,7 +28,6 @@ import org.eclipse.ocl.pivot.utilities.PivotConstants;
import org.eclipse.ocl.xtext.base.services.BaseLinkingService;
import org.eclipse.qvtd.xtext.qvtbase.tests.LoadTestCase;
import org.eclipse.qvtd.xtext.qvtbase.tests.utilities.TestsXMLUtil;
-import org.eclipse.qvtd.xtext.qvtcore.QVTcoreStandaloneSetup;
import org.eclipse.qvtd.xtext.qvtcorecs.QVTcoreCSPackage;
import org.eclipse.xtext.resource.XtextResource;
@@ -133,8 +132,8 @@ public class QVTcSerializeTests extends LoadTestCase
@Override
public void setUp() throws Exception {
BaseLinkingService.DEBUG_RETRY.setState(true);
+ LoadTests.doQVTcoreSetup();
super.setUp();
- QVTcoreStandaloneSetup.doSetup();
}
public void testSerialize_Class2RDBMS() throws Exception {
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/META-INF/MANIFEST.MF
index efb821f44..8f3515ed3 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/META-INF/MANIFEST.MF
@@ -11,13 +11,15 @@ Bundle-Localization: plugin
Require-Bundle: org.junit,
org.eclipse.core.resources,
org.eclipse.core.runtime,
+ org.eclipse.debug.core,
org.eclipse.ui.ide,
org.eclipse.ocl.examples.emf.validation.validity;bundle-version="[2.0.0,2.1.0)",
org.eclipse.ocl.examples.xtext.tests;bundle-version="[3.5.0,3.6.0)",
org.eclipse.ocl.xtext.completeocl;bundle-version="[1.0.0,1.1.0)",
org.eclipse.qvtd.codegen;bundle-version="[0.12.0,0.13.0)",
org.eclipse.qvtd.xtext.qvtimperative;bundle-version="[0.12.0,0.13.0)";visibility:=reexport,
- org.eclipse.qvtd.xtext.qvtbase.tests;bundle-version="[0.12.0,0.13.0)";visibility:=reexport
+ org.eclipse.qvtd.xtext.qvtbase.tests;bundle-version="[0.12.0,0.13.0)";visibility:=reexport,
+ org.eclipse.qvtd.debug
Export-Package: org.eclipse.qvtd.xtext.qvtimperative.tests,
classes,
classes.impl,
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/AllQVTimperativeTests.java b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/AllQVTimperativeTests.java
index 3e76c872d..69f537f12 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/AllQVTimperativeTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/AllQVTimperativeTests.java
@@ -13,6 +13,8 @@ package org.eclipse.qvtd.xtext.qvtimperative.tests;
import java.util.Arrays;
+import org.eclipse.emf.common.EMFPlugin;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -28,9 +30,11 @@ public class AllQVTimperativeTests extends TestCase
public static Test suite() {
TestSuite result = new TestSuite("All QVTimperative Tests");
result.addTestSuite(QVTiEditorTests.class);
- result.addTestSuite(QVTiInterpreterTests.class);
- result.addTestSuite(QVTiCompilerTests.class);
- result.addTestSuite(QVTiDomainUsageTests.class);
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) { // FIXME should work as plugin test too
+ result.addTestSuite(QVTiInterpreterTests.class);
+ result.addTestSuite(QVTiCompilerTests.class);
+ result.addTestSuite(QVTiDomainUsageTests.class);
+ }
result.addTestSuite(QVTiSerializeTests.class);
return result;
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiDebuggerTests.java b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiDebuggerTests.java
new file mode 100644
index 000000000..749e77331
--- /dev/null
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiDebuggerTests.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Willink Transformations 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:
+ * E.D.Willink - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.qvtd.xtext.qvtimperative.tests;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.examples.xtext.tests.TestUIUtil;
+import org.eclipse.ocl.examples.xtext.tests.TestUtil;
+import org.eclipse.ocl.examples.xtext.tests.XtextTestCase;
+import org.eclipse.qvtd.debug.launching.QVTiLaunchConstants;
+
+/**
+ * Tests that load a model and verify that there are no unresolved proxies as a result.
+ */
+public class QVTiDebuggerTests extends XtextTestCase
+{
+ protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(@NonNull IProject iProject, @NonNull String launchName,
+ @NonNull URI transformationURI, @NonNull Map<String,String> inKeys, @NonNull Map<String,String> outKeys) throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(QVTiLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID);
+ ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(iProject, launchName);
+ launchConfiguration.setAttribute(QVTiLaunchConstants.TX_KEY, transformationURI.toString());
+ launchConfiguration.setAttribute(QVTiLaunchConstants.IN_KEY, inKeys);
+ launchConfiguration.setAttribute(QVTiLaunchConstants.OUT_KEY, outKeys);
+ return launchConfiguration;
+ }
+
+ @SuppressWarnings("null")
+ @Override
+ protected @NonNull String getProjectName() {
+ return getClass().getPackage().getName().replace('.', '/');
+ }
+
+ public void testDebugger_Run_HSV2HLS() throws Exception {
+ TestUIUtil.closeIntro();
+ TestUIUtil.enableSwitchToDebugPerspectivePreference();
+ //
+ IProject iProject = TestUIUtil.createIProject("QVTiDebuggerTests");
+// IFile launchFile = TestUIUtil.copyIFile(iProject.getFile("HSV2HLS.launch"), getProjectFileURI("HSV2HLS/HSV2HLS.launch"), null);
+ IFile txFile = TestUIUtil.copyIFile(iProject.getFile("HSV2HLS.qvti"), getProjectFileURI("HSV2HLS/HSV2HLS.qvti"), "UTF-8");
+ TestUIUtil.copyIFile(iProject.getFile("HSVTree.ecore"), getProjectFileURI("HSV2HLS/HSVTree.ecore"), null);
+ TestUIUtil.copyIFile(iProject.getFile("HLSTree.ecore"), getProjectFileURI("HSV2HLS/HLSTree.ecore"), null);
+ TestUIUtil.copyIFile(iProject.getFile("HSV2HLS.ecore"), getProjectFileURI("HSV2HLS/HSV2HLS.ecore"), null);
+ IFile inFile = TestUIUtil.copyIFile(iProject.getFile("HSVNode.xmi"), getProjectFileURI("HSV2HLS/HSVNode.xmi"), null);
+ IFile outFile = iProject.getFile("HLSNode.xmi");
+ IFile middleFile = iProject.getFile("HSV2HLSNode.xmi");
+ @SuppressWarnings("null")@NonNull URI txURI = URI.createPlatformResourceURI(txFile.getFullPath().toString(), true);
+ URI inURI = URI.createPlatformResourceURI(inFile.getFullPath().toString(), true);
+ URI outURI = URI.createPlatformResourceURI(outFile.getFullPath().toString(), true);
+ URI middleURI = URI.createPlatformResourceURI(middleFile.getFullPath().toString(), true);
+ Map<String,String> inMap = new HashMap<String,String>();
+ inMap.put("hsv", inURI.toString());
+ Map<String,String> outMap = new HashMap<String,String>();
+ outMap.put("hls", outURI.toString());
+ outMap.put("middle", middleURI.toString());
+
+ ILaunchConfigurationWorkingCopy launchConfiguration = createLaunchConfiguration(iProject, "HSV2HLS", txURI, inMap, outMap);
+ launchConfiguration.doSave();
+ TestUIUtil.flushEvents();
+ ILaunch launch = launchConfiguration.launch(ILaunchManager.RUN_MODE, null);
+ assert launch != null;
+ TestUIUtil.waitForLaunchToTerminate(launch);
+ TestUIUtil.flushEvents();
+// outFile.refreshLocal(IResource.DEPTH_ZERO, null);
+ ResourceSet expectedResourceSet = new ResourceSetImpl();
+ Resource expectedResource = expectedResourceSet.getResource(getProjectFileURI("HSV2HLS/HLSNodeValidate.xmi"), true);
+ assert expectedResource != null;
+ ResourceSet actualResourceSet = new ResourceSetImpl();
+ Resource actualResource = actualResourceSet.getResource(outURI, true);
+ assert actualResource != null;
+ TestUtil.assertSameModel(expectedResource, actualResource);
+// ocl.dispose();
+ }
+}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiEditorTests.java b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiEditorTests.java
index 8217b74ac..1b11d3da3 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiEditorTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiEditorTests.java
@@ -12,6 +12,7 @@ package org.eclipse.qvtd.xtext.qvtimperative.tests;
import java.io.IOException;
+import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.pivot.utilities.OCL;
@@ -20,6 +21,8 @@ import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative;
import org.eclipse.qvtd.xtext.qvtbase.tests.LoadTestCase;
import org.eclipse.qvtd.xtext.qvtimperative.QVTimperativeStandaloneSetup;
+import com.google.inject.Guice;
+
/**
* Tests that load a model and verify that there are no unresolved proxies as a result.
*/
@@ -34,11 +37,25 @@ public class QVTiEditorTests extends LoadTestCase
ocl.dispose();
}
+ /**
+ * Perform the appropriate initialization to support QVTimperative parsing and editing using Xtext.
+ * NB. This must be called before setUp() creates a GlobalStateMemento if the aggressive DEBUG_GC
+ * garbage collection is enabled.
+ */
+ public static void doQVTimperativeSetup() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ QVTimperativeStandaloneSetup.doSetup();
+ }
+ else {
+ Guice.createInjector(new org.eclipse.qvtd.xtext.qvtimperative.QVTimperativeRuntimeModule());
+ }
+ }
+
@Override
protected void setUp() throws Exception {
BaseLinkingService.DEBUG_RETRY.setState(true);
+ doQVTimperativeSetup();
super.setUp();
- QVTimperativeStandaloneSetup.doSetup();
}
public void testLoad_HSV2HLS_qvti() throws IOException, InterruptedException {
doLoad_Concrete("HSV2HLS/HSV2HLS.qvti");
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiSerializeTests.java b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiSerializeTests.java
index f3b0feee0..043f0ff41 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiSerializeTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiSerializeTests.java
@@ -30,7 +30,6 @@ import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbase;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative;
import org.eclipse.qvtd.xtext.qvtbase.tests.LoadTestCase;
import org.eclipse.qvtd.xtext.qvtbase.tests.utilities.TestsXMLUtil;
-import org.eclipse.qvtd.xtext.qvtimperative.QVTimperativeStandaloneSetup;
import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.xtext.resource.XtextResource;
@@ -122,8 +121,8 @@ public class QVTiSerializeTests extends LoadTestCase
@Override
public void setUp() throws Exception {
BaseLinkingService.DEBUG_RETRY.setState(true);
+ QVTiEditorTests.doQVTimperativeSetup();
super.setUp();
- QVTimperativeStandaloneSetup.doSetup();
}
public void testSerialize_Expressions() throws Exception {

Back to the top