Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-10-11 12:57:59 +0000
committerEd Willink2016-10-13 15:19:16 +0000
commit1b924b71e2ef31114e5ad6c78428b816cb946a3d (patch)
tree525b0d514b827d34f581e4aeb17ed30520e69543
parent06b1fd154188cf975d6f601948c975806184258f (diff)
downloadorg.eclipse.qvtd-1b924b71e2ef31114e5ad6c78428b816cb946a3d.tar.gz
org.eclipse.qvtd-1b924b71e2ef31114e5ad6c78428b816cb946a3d.tar.xz
org.eclipse.qvtd-1b924b71e2ef31114e5ad6c78428b816cb946a3d.zip
[unrelated] Enforce order to avoid failure after Example 1 change.
-rw-r--r--tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java43
1 files changed, 17 insertions, 26 deletions
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 9ea242f4f..059d9debc 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
@@ -12,10 +12,7 @@ package org.eclipse.qvtd.cs2as.compiler.tests;
import java.io.IOException;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
-
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -62,21 +59,22 @@ import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.xtext.resource.XtextResource;
import org.junit.After;
import org.junit.Before;
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
import cg._Source2Target_qvtp_qvtcas.Source2Target_qvtp_qvtcas;
import example1.source.SourcePackage;
import example1.target.TargetPackage;
import example2.classes.ClassesPackage;
import example2.classescs.ClassescsPackage;
-import example4.kiamaas.KiamaasPackage;
-import example4.kiamacs.KiamacsPackage;
+import example5.sbase.SbasePackage;
+import example5.sderived.SderivedPackage;
+import example5.tbase.TbasePackage;
+import example5.tderived.TderivedPackage;
-/**
- * @author asbh500
- *
- *
- */
+// Manual load tests rely on previous generation of the class to load. - testExample1_CGManual
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class OCL2QVTiTestCases extends LoadTestCase {
// private static final boolean CREATE_GRAPHML = false; // Note. You need Epsilon with Bug 458724 fix to have output graphml models serialised
@@ -90,7 +88,6 @@ public class OCL2QVTiTestCases extends LoadTestCase {
protected final @NonNull String testName;
protected final @NonNull URI baseURI;
// protected final @NonNull URI samplesBaseUri;
- private Set<@NonNull String> nsURIs = new HashSet<@NonNull String>();
public MyQVT(@NonNull String testName) {
super(new QVTiEnvironmentFactory(getProjectMap(), null));
@@ -99,18 +96,6 @@ public class OCL2QVTiTestCases extends LoadTestCase {
// this.samplesBaseUri = baseURI.appendSegment("samples");
}
- @Override
- public synchronized void dispose() {
- super.dispose();
- /**
- * Remove the eInstances from the EPackage.Registry.INSTANCE so that global registrations from the calling test
- * do not confuse subsequent tests that may want to use dynamic models.
- */
- for (String nsURI : nsURIs) {
- EPackage.Registry.INSTANCE.remove(nsURI);
- }
- }
-
//
// Execute the transformation with the interpreter
//
@@ -283,7 +268,7 @@ public class OCL2QVTiTestCases extends LoadTestCase {
myQVT.dispose();
}
- @Test // FIXME this will fail if testExample1_CG has not been run previously
+ @Test
public void testExample1_CGManual() throws Exception {
MyQVT myQVT = new MyQVT("example1");
Class<Source2Target_qvtp_qvtcas> txClass = Source2Target_qvtp_qvtcas.class;
@@ -534,6 +519,8 @@ public class OCL2QVTiTestCases extends LoadTestCase {
// executeModelsTX_CG(myQVT, txClass, testBaseURI, "model0");
myQVT.executeModelsTX_CG(txClass, "model1");
myQVT.dispose();
+ EPackage.Registry.INSTANCE.remove(example3.kiamaas.KiamaasPackage.eNS_URI);
+ EPackage.Registry.INSTANCE.remove(example3.kiamacs.KiamacsPackage.eNS_URI);
}
@Test
@@ -584,8 +571,8 @@ public class OCL2QVTiTestCases extends LoadTestCase {
myQVT.dispose();
myQVT = new MyQVT("example4");
- myQVT.loadEcoreFile("SimplerKiamaCS.ecore", KiamacsPackage.eINSTANCE);
- myQVT.loadEcoreFile("SimplerKiamaAS.ecore", KiamaasPackage.eINSTANCE);
+ myQVT.loadEcoreFile("SimplerKiamaCS.ecore", example4.kiamacs.KiamacsPackage.eINSTANCE);
+ myQVT.loadEcoreFile("SimplerKiamaAS.ecore", example4.kiamaas.KiamaasPackage.eINSTANCE);
ImperativeTransformation tx = getTransformation(myQVT.getMetamodelManager().getASResourceSet(), txURI);
// myQVT.getEnvironmentFactory().setEvaluationTracingEnabled(true);
@@ -626,6 +613,10 @@ public class OCL2QVTiTestCases extends LoadTestCase {
// Execute CGed transformation
myQVT.executeModelsTX_CG(txClass, "model2");
myQVT.dispose();
+ EPackage.Registry.INSTANCE.remove(SbasePackage.eNS_URI);
+ EPackage.Registry.INSTANCE.remove(SderivedPackage.eNS_URI);
+ EPackage.Registry.INSTANCE.remove(TbasePackage.eNS_URI);
+ EPackage.Registry.INSTANCE.remove(TderivedPackage.eNS_URI);
}
@Test

Back to the top