Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo SBH2015-05-05 17:20:03 +0000
committerAdolfo SBH2015-05-08 10:01:37 +0000
commitc6b5af066bce3cdb50fe6cb04d8b48719ab0ffbf (patch)
tree66592e1a29b6e3c66ee940fb0045745d23099256
parent75029c66fad6a0c305e7cac86b9d4e592e9ef513 (diff)
downloadorg.eclipse.qvtd-c6b5af066bce3cdb50fe6cb04d8b48719ab0ffbf.tar.gz
org.eclipse.qvtd-c6b5af066bce3cdb50fe6cb04d8b48719ab0ffbf.tar.xz
org.eclipse.qvtd-c6b5af066bce3cdb50fe6cb04d8b48719ab0ffbf.zip
[ocl2qvti] - Aligning with the new QVTimperative/QVT
-rw-r--r--plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/CS2ASJavaCompiler.java4
-rw-r--r--plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/OCL2QVTiCGTxCompiler.java4
-rw-r--r--plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/CS2ASJavaCompilerImpl.java6
-rw-r--r--plugins/org.eclipse.qvtd.cs2as.runtime/src/org/eclipse/qvtd/cs2as/runtime/QVTiTxHelper.java (renamed from plugins/org.eclipse.qvtd.cs2as.runtime/src/org/eclipse/qvtd/cs2as/runtime/QVTiFacade.java)25
-rw-r--r--tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java23
5 files changed, 30 insertions, 32 deletions
diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/CS2ASJavaCompiler.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/CS2ASJavaCompiler.java
index 2f824f532..2df946b5d 100644
--- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/CS2ASJavaCompiler.java
+++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/CS2ASJavaCompiler.java
@@ -2,11 +2,11 @@ package org.eclipse.qvtd.cs2as.compiler;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.qvtd.cs2as.runtime.CS2ASTransformation;
-import org.eclipse.qvtd.cs2as.runtime.QVTiFacade;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
+import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative;
public interface CS2ASJavaCompiler {
- public Class<? extends CS2ASTransformation> compileTransformation(@NonNull QVTiFacade qvt,
+ public Class<? extends CS2ASTransformation> compileTransformation(@NonNull QVTimperative qvt,
@NonNull Transformation transformation, @NonNull CS2ASJavaCompilerParameters params) throws Exception;
}
diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/OCL2QVTiCGTxCompiler.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/OCL2QVTiCGTxCompiler.java
index adc5cef4c..d06edd89c 100644
--- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/OCL2QVTiCGTxCompiler.java
+++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/OCL2QVTiCGTxCompiler.java
@@ -13,7 +13,7 @@ import org.eclipse.qvtd.compiler.internal.etl.PivotModel;
import org.eclipse.qvtd.cs2as.compiler.internal.CS2ASJavaCompilerImpl;
import org.eclipse.qvtd.cs2as.compiler.internal.OCL2QVTiBroker;
import org.eclipse.qvtd.cs2as.runtime.CS2ASTransformation;
-import org.eclipse.qvtd.cs2as.runtime.QVTiFacade;
+import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative;
import org.eclipse.qvtd.xtext.qvtimperative.QVTimperativeStandaloneSetup;
public class OCL2QVTiCGTxCompiler implements OCL2JavaTxCompiler<CS2ASJavaCompilerParameters> {
@@ -26,7 +26,7 @@ public class OCL2QVTiCGTxCompiler implements OCL2JavaTxCompiler<CS2ASJavaCompile
@Override
public Class<? extends CS2ASTransformation> compileTransformation(@NonNull URI oclDocURI, @NonNull CS2ASJavaCompilerParameters params, @Nullable ResourceSet rSet) throws Exception {
- QVTiFacade qvt = QVTiFacade.createInstance(BasicProjectManager.CLASS_PATH, rSet);
+ QVTimperative qvt = QVTimperative.newInstance(BasicProjectManager.CLASS_PATH, rSet);
try {
PivotModel qvtiTransf = executeOCL2QVTi_MTC(qvt, oclDocURI.trimSegments(1), oclDocURI.lastSegment());
return createCompiler().compileTransformation(qvt, qvtiTransf.getTransformation(), (CS2ASJavaCompilerParameters) params);
diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/CS2ASJavaCompilerImpl.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/CS2ASJavaCompilerImpl.java
index b9b36994b..ed6af4c84 100644
--- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/CS2ASJavaCompilerImpl.java
+++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/CS2ASJavaCompilerImpl.java
@@ -42,17 +42,17 @@ import org.eclipse.qvtd.codegen.qvti.java.QVTiGlobalContext;
import org.eclipse.qvtd.codegen.qvticgmodel.CGGuardVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGMapping;
import org.eclipse.qvtd.codegen.utilities.QVTiCGUtil;
-import org.eclipse.qvtd.cs2as.compiler.CS2ASJavaCompilerParameters;
import org.eclipse.qvtd.cs2as.compiler.CS2ASJavaCompiler;
+import org.eclipse.qvtd.cs2as.compiler.CS2ASJavaCompilerParameters;
import org.eclipse.qvtd.cs2as.compiler.cgmodel.CGLookupCallExp;
import org.eclipse.qvtd.cs2as.compiler.cgmodel.CS2ASCGFactory;
import org.eclipse.qvtd.cs2as.compiler.cgmodel.util.CS2ASCGModelVisitor;
import org.eclipse.qvtd.cs2as.runtime.CS2ASTransformation;
import org.eclipse.qvtd.cs2as.runtime.CS2ASTransformationExecutor;
-import org.eclipse.qvtd.cs2as.runtime.QVTiFacade;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.evaluation.AbstractTransformationExecutor;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
+import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative;
public class CS2ASJavaCompilerImpl implements CS2ASJavaCompiler {
@@ -427,7 +427,7 @@ public class CS2ASJavaCompilerImpl implements CS2ASJavaCompiler {
// Copied from QVTiCompilerTest
@Override
- public Class<? extends CS2ASTransformation> compileTransformation(@NonNull QVTiFacade qvt,
+ public Class<? extends CS2ASTransformation> compileTransformation(@NonNull QVTimperative qvt,
@NonNull Transformation transformation, @NonNull CS2ASJavaCompilerParameters params) throws Exception {
QVTiCodeGenerator cg = new CS2ASJavaCodeGenerator(qvt.getEnvironmentFactory(), transformation, params);
diff --git a/plugins/org.eclipse.qvtd.cs2as.runtime/src/org/eclipse/qvtd/cs2as/runtime/QVTiFacade.java b/plugins/org.eclipse.qvtd.cs2as.runtime/src/org/eclipse/qvtd/cs2as/runtime/QVTiTxHelper.java
index 254497ea4..406186c0d 100644
--- a/plugins/org.eclipse.qvtd.cs2as.runtime/src/org/eclipse/qvtd/cs2as/runtime/QVTiFacade.java
+++ b/plugins/org.eclipse.qvtd.cs2as.runtime/src/org/eclipse/qvtd/cs2as/runtime/QVTiTxHelper.java
@@ -2,25 +2,23 @@ package org.eclipse.qvtd.cs2as.runtime;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.resource.ProjectManager;
-import org.eclipse.ocl.pivot.utilities.OCL;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.evaluation.TransformationExecutor;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiPivotEvaluator;
+import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative;
-public class QVTiFacade extends OCL {
+public class QVTiTxHelper {
- protected QVTiFacade(@NonNull QVTiEnvironmentFactory environmentFactory) {
- super(environmentFactory);
+ final private QVTimperative qvti;
+
+ public QVTiTxHelper(@NonNull QVTimperative qvti) {
+ this.qvti = qvti;
}
- @Override
- public @NonNull QVTiEnvironmentFactory getEnvironmentFactory() {
- return (QVTiEnvironmentFactory) super.getEnvironmentFactory();
+ private @NonNull QVTiEnvironmentFactory getEnvironmentFactory() {
+ return (QVTiEnvironmentFactory) qvti.getEnvironmentFactory();
}
public @NonNull QVTiPivotEvaluator createEvaluator(Transformation transformation) {
@@ -30,10 +28,7 @@ public class QVTiFacade extends OCL {
// FIXME why do we need this ?
public @NonNull QVTiTxEvaluator createTxEvaluator(Class<? extends TransformationExecutor> txClass)
throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
- return new QVTiTxEvaluator(environmentFactory.getCompleteEnvironment(), txClass);
+ return new QVTiTxEvaluator(getEnvironmentFactory().getCompleteEnvironment(), txClass);
}
-
- public static QVTiFacade createInstance(@NonNull ProjectManager projectManager, @Nullable ResourceSet rSet) {
- return new QVTiFacade(new QVTiEnvironmentFactory(projectManager, rSet));
- }
+
}
diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java
index 6e36d7b07..1245ed477 100644
--- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java
+++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java
@@ -43,7 +43,7 @@ import org.eclipse.qvtd.cs2as.compiler.CS2ASJavaCompilerParameters;
import org.eclipse.qvtd.cs2as.compiler.internal.CS2ASJavaCompilerImpl;
import org.eclipse.qvtd.cs2as.compiler.internal.CS2ASJavaCompilerParametersImpl;
import org.eclipse.qvtd.cs2as.compiler.internal.OCL2QVTiBroker;
-import org.eclipse.qvtd.cs2as.runtime.QVTiFacade;
+import org.eclipse.qvtd.cs2as.runtime.QVTiTxHelper;
import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.evaluation.TransformationEvaluator;
@@ -52,6 +52,7 @@ import org.eclipse.qvtd.pivot.qvtcorebase.QVTcoreBasePackage;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiPivotEvaluator;
+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;
@@ -66,7 +67,7 @@ import org.junit.Test;
*/
public class OCL2QVTiTestCases extends LoadTestCase {
- private static final boolean CREATE_GRAPHML = true; // Note. You need Epsilon with Bug 458724 fix to have output graphml models serialised
+ private static final boolean CREATE_GRAPHML = false; // Note. You need Epsilon with Bug 458724 fix to have output graphml models serialised
private static final String TESTS_GEN_PATH = "../org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/";
private static final String TESTS_PACKAGE_NAME = "cg";
private static final String DEBUG_SEGMENT = "debug";
@@ -102,7 +103,7 @@ public class OCL2QVTiTestCases extends LoadTestCase {
}
}
- @NonNull private QVTiFacade myQVT;
+ @NonNull private QVTimperative myQVT;
@Before
public void setUp() throws Exception {
@@ -119,8 +120,8 @@ public class OCL2QVTiTestCases extends LoadTestCase {
super.tearDown();
}
- protected @NonNull QVTiFacade createQVT() {
- return QVTiFacade.createInstance(getProjectMap(), null);
+ protected @NonNull QVTimperative createQVT() {
+ return QVTimperative.newInstance(getProjectMap(), null);
}
@@ -311,7 +312,7 @@ public class OCL2QVTiTestCases extends LoadTestCase {
assertValidModel(asURI, asResourceSet);
}
- protected PivotModel executeOCL2QVTi_MTC(QVTiFacade qvt, URI baseURI, String oclDocName) throws Exception {
+ protected PivotModel executeOCL2QVTi_MTC(QVTimperative qvt, URI baseURI, String oclDocName) throws Exception {
OCL2QVTiBroker mtc = new OCL2QVTiBroker(baseURI, oclDocName, qvt, TestsXMLUtil.defaultSavingOptions);
mtc.setCreateGraphml(CREATE_GRAPHML);
@@ -331,9 +332,10 @@ public class OCL2QVTiTestCases extends LoadTestCase {
//
// Execute the transformation with the interpreter
//
- protected void executeModelsTX_CG(QVTiFacade qvt, Class<? extends TransformationExecutor> txClass, URI baseURI, String modelName) throws Exception {
+ protected void executeModelsTX_CG(QVTimperative qvt, Class<? extends TransformationExecutor> txClass, URI baseURI, String modelName) throws Exception {
- TransformationEvaluator evaluator = qvt.createTxEvaluator(txClass);
+ QVTiTxHelper txHelper = new QVTiTxHelper(qvt);
+ TransformationEvaluator evaluator = txHelper.createTxEvaluator(txClass);
TransformationExecutor tx = evaluator.getExecutor();
URI samplesBaseUri = baseURI.appendSegment("samples");
URI csModelURI = samplesBaseUri.appendSegment(String.format("%s_input.xmi", modelName));
@@ -357,7 +359,7 @@ public class OCL2QVTiTestCases extends LoadTestCase {
// Execute the transformation with the CGed transformation
//
- protected void executeModelsTX_Interpreted(QVTiFacade qvt, Transformation tx, URI baseURI, String modelName) throws Exception {
+ protected void executeModelsTX_Interpreted(QVTimperative qvt, Transformation tx, URI baseURI, String modelName) throws Exception {
URI samplesBaseUri = baseURI.appendSegment("samples");
URI csModelURI = samplesBaseUri.appendSegment(String.format("%s_input.xmi", modelName));
@@ -365,7 +367,8 @@ public class OCL2QVTiTestCases extends LoadTestCase {
URI expectedAsModelURI = samplesBaseUri.appendSegment(String.format("%s_output_ref.xmi", modelName));
saveEmptyModel(asModelURI);
- QVTiPivotEvaluator testEvaluator = qvt.createEvaluator(tx);
+ QVTiTxHelper txHelper = new QVTiTxHelper(qvt);
+ QVTiPivotEvaluator testEvaluator = txHelper.createEvaluator(tx);
testEvaluator.saveTransformation(null);
testEvaluator.loadModel("leftCS", csModelURI);
testEvaluator.createModel("rightAS", asModelURI, null);

Back to the top