diff options
author | cgerking | 2015-09-11 09:51:52 +0000 |
---|---|---|
committer | sboyko | 2015-09-24 15:56:40 +0000 |
commit | 324af3c19b4d8c33add71495c98a1712682ae983 (patch) | |
tree | 956b6e6c3c5f29f908d87124555ca4f604058377 | |
parent | 07b299d2a14a3d815e7c1f9e4b857dce35b65e4d (diff) | |
download | org.eclipse.qvto-324af3c19b4d8c33add71495c98a1712682ae983.tar.gz org.eclipse.qvto-324af3c19b4d8c33add71495c98a1712682ae983.tar.xz org.eclipse.qvto-324af3c19b4d8c33add71495c98a1712682ae983.zip |
[477155] Switch to JUnit4 parameterized tests
85 files changed, 1256 insertions, 1069 deletions
diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.AllTests.launch b/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.AllTests.launch index c25f3508f..d4a07d685 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.AllTests.launch +++ b/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.AllTests.launch @@ -1,41 +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.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/AllTests.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.junit3"/> -<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.m2m.tests.qvt.oml.AllTests"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.m2m.tests.qvt.oml"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms128m -Xmx1G -XX:MaxPermSize=256M -ea"/> -<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> +<?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.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/AllTests.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.m2m.tests.qvt.oml.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.m2m.tests.qvt.oml"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms128m -Xmx1G -XX:MaxPermSize=256M -ea"/>
+<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.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.StandaloneTests.launch b/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.StandaloneTests.launch index d654a17fa..8aab24be6 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.StandaloneTests.launch +++ b/tests/org.eclipse.m2m.tests.qvt.oml/org.eclipse.m2m.tests.qvt.oml.StandaloneTests.launch @@ -1,22 +1,22 @@ -<?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.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/StandaloneTests.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.junit3"/> -<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> -<listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> -<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5" javaProject="org.eclipse.m2m.tests.qvt.oml" path="1" type="4"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="org.eclipse.m2m.tests.qvt.oml"/> </runtimeClasspathEntry> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.eclipse.m2m.tests.qvt.oml/parserTestData" path="3" type="2"/> "/> -</listAttribute> -<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> -<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.m2m.tests.qvt.oml.transform.StandaloneTests"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.m2m.tests.qvt.oml"/> -</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.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtStandaloneExecutor.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"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5" javaProject="org.eclipse.m2m.tests.qvt.oml" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="org.eclipse.m2m.tests.qvt.oml"/> </runtimeClasspathEntry> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.eclipse.m2m.tests.qvt.oml/parserTestData" path="3" type="2"/> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.m2m.tests.qvt.oml.callapi.TestQvtStandaloneExecutor"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.m2m.tests.qvt.oml"/>
+</launchConfiguration>
diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/AllTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/AllTests.java index 9f7b6da53..908cff97d 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/AllTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/AllTests.java @@ -17,77 +17,89 @@ */ package org.eclipse.m2m.tests.qvt.oml; -import org.eclipse.m2m.tests.qvt.oml.ant.QvtAntScriptTests; +import org.eclipse.m2m.tests.qvt.oml.ant.TestQvtAntScript; import org.eclipse.m2m.tests.qvt.oml.callapi.AllCallAPITests; +import org.eclipse.m2m.tests.qvt.oml.callapi.DebugExecutorTest; import org.eclipse.m2m.tests.qvt.oml.callapi.SourceContainerTests; +import org.eclipse.m2m.tests.qvt.oml.callapi.TestQvtExecutor; import org.eclipse.m2m.tests.qvt.oml.compile.AllCompileTests; -import org.eclipse.m2m.tests.qvt.oml.emf.AllEmfTests; +import org.eclipse.m2m.tests.qvt.oml.emf.TestEmfUtil; import org.eclipse.m2m.tests.qvt.oml.env.QVTOperationalEnvTest; import org.eclipse.m2m.tests.qvt.oml.ocl2qvt.OCLEnvWithQVTTests; import org.eclipse.m2m.tests.qvt.oml.perf.ExecutionTimeGuardTest; -import org.eclipse.m2m.tests.qvt.oml.transform.TraceTests; +import org.eclipse.m2m.tests.qvt.oml.traces.TestTraceFile; +import org.eclipse.m2m.tests.qvt.oml.transform.TestQvtWalker; import org.eclipse.m2m.tests.qvt.oml.transform.TransformManyModelTests; import org.eclipse.m2m.tests.qvt.oml.transform.TransformTests; import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests; +import org.eclipse.m2m.tests.qvt.oml.transform.javaless.JavalessQvtTest; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; -import junit.framework.Test; -import junit.framework.TestSuite; +import junit.framework.JUnit4TestAdapter; +import junit.framework.TestCase; /** * @author vrepeshko * */ -public class AllTests { +@RunWith(Suite.class) +@SuiteClasses( + { + IntermediatePropertyCleanupTest.class, + AllCompileTests.class, + AllCallAPITests.class, + + QVTOperationalEnvTest.class, + + OCLEnvWithQVTTests.class, + + TestExternHelperCall.class, + TestEmfUtil.class, + TestMetamodelRegistry.class, + TestLaunchConfiguration.class, + ParserTests.class, + + TransformTests.class, + JavalessQvtTest.class, + TestQvtWalker.class, + TestQvtExecutor.class, + DebugExecutorTest.class, + TransformManyModelTests.class, + QvtoTransfHelperTests.class, + + TestQvtBuilder.class, + TestSamples.class, + TestGraphWalker.class, + TestTraceFile.class, + + TestQvtResourceFactory.class, + + TestOCLSemantics.class, + TestOCLAnnotationSupport.class, + + TestParsingMACLineBreaks.class, + + TestQvtAntScript.class, + SourceContainerTests.class, + + ExecutionTimeGuardTest.class + } +) +public class AllTests extends TestCase { public static final String BUNDLE_ID = "org.eclipse.m2m.tests.qvt.oml"; //$NON-NLS-1$ - + public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.suite()); + junit.textui.TestRunner.run(new JUnit4TestAdapter(AllTests.class)); } - - public static Test suite() { + + @BeforeClass + public static void prepare() { TestUtil.suppressGitPrefixPopUp(); - TestSuite suite = new TestSuite("Tests for " + BUNDLE_ID); //$NON-NLS-1$ - //$JUnit-BEGIN$ - suite.addTestSuite(IntermediatePropertyCleanupTest.class); - suite.addTest(AllCompileTests.suite()); - suite.addTest(AllCallAPITests.suite()); - - suite.addTestSuite(QVTOperationalEnvTest.class); - - suite.addTest(OCLEnvWithQVTTests.suite()); - - suite.addTestSuite(TestExternHelperCall.class); - suite.addTest(AllEmfTests.suite()); - suite.addTestSuite(TestMetamodelRegistry.class); - suite.addTestSuite(TestLaunchConfiguration.class); - suite.addTest(ParserTests.suite()); - - suite.addTest(TransformTests.interpreterSuite()); - suite.addTest(TransformTests.javalessSuite()); - suite.addTest(TransformTests.walkerSuite()); - suite.addTest(TransformTests.executorSuite()); - suite.addTest(TransformTests.debugExecutorSuite()); - suite.addTest(TransformManyModelTests.interpreterSuite()); - suite.addTest(QvtoTransfHelperTests.suite()); - - suite.addTestSuite(TestQvtBuilder.class); - suite.addTestSuite(TestSamples.class); - suite.addTestSuite(TestGraphWalker.class); - suite.addTest(TraceTests.suite()); - suite.addTest(TestQvtResourceFactory.suite()); - - suite.addTestSuite(TestOCLSemantics.class); - suite.addTestSuite(TestOCLAnnotationSupport.class); - - suite.addTest(QvtAntScriptTests.suite()); - suite.addTest(SourceContainerTests.suite()); - - suite.addTestSuite(ExecutionTimeGuardTest.class); - - //$JUnit-END$ - return suite; } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/IntermediatePropertyCleanupTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/IntermediatePropertyCleanupTest.java index 4b2d5606e..dcd950ee0 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/IntermediatePropertyCleanupTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/IntermediatePropertyCleanupTest.java @@ -21,6 +21,8 @@ import org.eclipse.m2m.qvt.oml.BasicModelExtent; import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -42,6 +44,7 @@ public class IntermediatePropertyCleanupTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -59,7 +62,8 @@ public class IntermediatePropertyCleanupTest extends TestCase { assertFalse(fInput.getContents().isEmpty()); assertTrue(fOutput.getContents().isEmpty()); } - + + @Test public void testIntermPropCleanup() throws Exception { final ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); assertEquals(Diagnostic.OK, diagnostic.getSeverity()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ParserTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ParserTests.java index 3a8709737..e9ba25160 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ParserTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ParserTests.java @@ -13,22 +13,13 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml; -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; +@RunWith(Suite.class) +@SuiteClasses({QvtLibraryASTTest.class, TestQvtParser.class}) public class ParserTests { - public static Test suite() { - TestSuite suite = new TestSuite("QVT parser"); //$NON-NLS-1$ - - suite.addTest(new QvtLibraryASTTest()); - - for (int i = 0; i < ourData.length; i++) { - TestData data = ourData[i]; - suite.addTest(new TestQvtParser(data)); - } - - return suite; - } public static class TestData { public TestData(String dir, int errCount) { @@ -68,160 +59,5 @@ public class ParserTests { data.usesSourceAnnotations = true; return data; } - } - - - static TestData getTestData(String name) { - for (TestData data : ourData) { - if(name.equals(data.getDir())) { - return data; - } - } - - throw new IllegalArgumentException("No such testdata: " + name); //$NON-NLS-1$ - } - - private static TestData[] ourData = new TestData[] { - TestData.createSourceChecked("abstractout", 3, 0), //$NON-NLS-1$ - TestData.createSourceChecked("collectionAssignment", 4, 0), //$NON-NLS-1$ - TestData.createSourceChecked("overload_multipleParams", 0, 19), //$NON-NLS-1$ - TestData.createSourceChecked("overload_singleParam", 0, 0), //$NON-NLS-1$ - TestData.createSourceChecked("mainInLibrary", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("dynamicpackage", 0, 0), //$NON-NLS-1$ - TestData.createSourceChecked("importedInstances", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("moduleElementErrorRecovery_265452", 7, 0), //$NON-NLS-1$ - TestData.createSourceChecked("unitElementErrorRecovery_264517_1", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("unitElementErrorRecovery_264517_2", 3, 0), //$NON-NLS-1$ - TestData.createSourceChecked("unitElementErrorRecovery_264675", 3, 0), //$NON-NLS-1$ - TestData.createSourceChecked("nestedPropertiesAssignment_262757", 7, 0), //$NON-NLS-1$ - TestData.createSourceChecked("collectionOperationNotFound_224093", 3, 0), //$NON-NLS-1$ - TestData.createSourceChecked("deprecated_importLocation", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("misplacedTopElements", 0, 4), //$NON-NLS-1$ - TestData.createSourceChecked("escape_sequences_250630", 4, 0), //$NON-NLS-1$ - TestData.createSourceChecked("multiline_strings_262733", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("deprecated_rename", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("varInitExpWithResult_261623", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("_while_261024", 4, 0), //$NON-NLS-1$ - TestData.createSourceChecked("listtype", 7, 0), //$NON-NLS-1$ - TestData.createSourceChecked("listtype2", 7, 0), //$NON-NLS-1$ - //new TestData("orderedsetdoesnotconformtoset", 1), //$NON-NLS-1$ - TestData.createSourceChecked("computeExp_252269", 3, 1), //$NON-NLS-1$ - new TestData("implicitsource_ocl_234354", 7, 0), //$NON-NLS-1$ - TestData.createSourceChecked("duplicateModelTypeDef", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("blackboxlib_annotation_java", 1, 2), //$NON-NLS-1$ - TestData.createSourceChecked("dupImportFileUnit", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("dupImportLibrary", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("testmodelparamtype", 3, 0), //$NON-NLS-1$ - TestData.createSourceChecked("resolvecond", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("intermPropClash", 9, 0), //$NON-NLS-1$ - TestData.createSourceChecked("noClassInImplicitPopulate", 3, 1), //$NON-NLS-1$ - TestData.createSourceChecked("parmnamesclash", 22, 1), //$NON-NLS-1$ - TestData.createSourceChecked("stdlibElementAsOut", 7, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug2732_wrongcondition", 1, 1), //$NON-NLS-1$ - TestData.createSourceChecked("varscope", 10, 0), //$NON-NLS-1$ - TestData.createSourceChecked("_while", 12, 0), //$NON-NLS-1$ - TestData.createSourceChecked("implicitCallSrc", 16, 6), //$NON-NLS-1$ - TestData.createSourceChecked("libraryWithModuleElements", 2, 0), //$NON-NLS-1$ - new TestData("assert_log", 0), //$NON-NLS-1$ - new TestData("opersignatureparamclash", 1), //$NON-NLS-1$ - new TestData("collectreturntype", 0), //$NON-NLS-1$ - new TestData("nocollectoncollection", 0), //$NON-NLS-1$ - ///Commented out, due to migration to OCL 1.2, TODO - clarify the current error reporting with MDT, seems to be incorrect - // new TestData("nonstaticcallinstaticcontext", 1), //$NON-NLS-1$ - new TestData("virtrettypemismatch", 1), //$NON-NLS-1$ - new TestData("missinglibmmimport", 1), //$NON-NLS-1$ - new TestData("noglobalallinstances", 0), //$NON-NLS-1$ - new TestData("imp", 0), //$NON-NLS-1$ // TODO: independent parsing for imports - new TestData("imp2", 0), //$NON-NLS-1$ - new TestData("imp3", 0), //$NON-NLS-1$ - TestData.createSourceChecked("impError", 3, 0), //$NON-NLS-1$ - new TestData("assignereadonlyprop", 1), //$NON-NLS-1$ - new TestData("nonbooleanguard", 1), //$NON-NLS-1$ - TestData.createSourceChecked("sameparamname", 2, 0), //$NON-NLS-1$ - new TestData("badtype", 1), //$NON-NLS-1$ - new TestData("simple", 0), //$NON-NLS-1$ - new TestData("selfimport", 1), //$NON-NLS-1$ - new TestData("normalimport", 0), //$NON-NLS-1$ - new TestData("missingmappingcall", 1), //$NON-NLS-1$ - new TestData("missingfeature", 1), //$NON-NLS-1$ - new TestData("featuretypemismatch", 1), //$NON-NLS-1$ - new TestData("initvariable", 1), //$NON-NLS-1$ - new TestData("missingvariablereference", 1), //$NON-NLS-1$ - new TestData("optionalout", 0), //$NON-NLS-1$ - new TestData("nonassignableout", 1), //$NON-NLS-1$ - TestData.createSourceChecked("wrongout", 3, 0), //$NON-NLS-1$ - new TestData("outininitvar", 0), //$NON-NLS-1$ - new TestData("modifyfeature", 0), //$NON-NLS-1$ - new TestData("missingout", 2), //$NON-NLS-1$ - new TestData("modifyfeatureerror", 2), //$NON-NLS-1$ - new TestData("bodywithsemicolon", 0), //$NON-NLS-1$ - new TestData("modifyparam", 0), //$NON-NLS-1$ - TestData.createSourceChecked("wrongparamnameinout", 2, 0), //$NON-NLS-1$ - new TestData("modifyfeatureininiterror", 2), //$NON-NLS-1$ - TestData.createSourceChecked("voidout", 2, 0), //$NON-NLS-1$ - new TestData("modifyinparam", 1), //$NON-NLS-1$ - new TestData("modifyresult", 0), //$NON-NLS-1$ - new TestData("wrongorderininit", 1), //$NON-NLS-1$ - new TestData("duplicateinitvariable", 1), //$NON-NLS-1$ - TestData.createSourceChecked("missingObjectType", 1, 0), // replaced former 'nestedouterror' //$NON-NLS-1$ - new TestData("emptyinit", 0), //$NON-NLS-1$ - new TestData("assignresultininit", 0), //$NON-NLS-1$ - new TestData("assign_inoutParam", 2), //$NON-NLS-1$ - new TestData("assign_inParam", 2), //$NON-NLS-1$ - new TestData("assign_varThis", 1), //$NON-NLS-1$ - - new TestData("errorinexpressionlist", 1), //$NON-NLS-1$ - new TestData("largefile", 0), //$NON-NLS-1$ - new TestData("calldump", 0), //$NON-NLS-1$ - new TestData("missingparamname", 2), //$NON-NLS-1$ - new TestData("nameclash", 1), //$NON-NLS-1$ - new TestData("emptymodule", 0), //$NON-NLS-1$ - new TestData("props", 0), //$NON-NLS-1$ - new TestData("duplicatelocalproperty", 1), //$NON-NLS-1$ - new TestData("wrongorderinproperty", 1), //$NON-NLS-1$ - new TestData("implicitpopulation", 0), //$NON-NLS-1$ - new TestData("implicitpopulationwithinit", 0), //$NON-NLS-1$ - new TestData("mapkeyword", 0), //$NON-NLS-1$ - new TestData("endsectfull", 0), //$NON-NLS-1$ - new TestData("endsectimplicitpopulation", 0), //$NON-NLS-1$ - new TestData("endsectimplicitpopulationnoinit", 0), //$NON-NLS-1$ - new TestData("endsectinitnopopulation", 0), //$NON-NLS-1$ - new TestData("endsectonly", 0), //$NON-NLS-1$ - new TestData("endsectpopulationnoinit", 0), //$NON-NLS-1$ - new TestData("configpropstype", 0), //$NON-NLS-1$ - - new TestData("mm_header1", 1), //$NON-NLS-1$ - new TestData("mm_header2", 1), //$NON-NLS-1$ - new TestData("mm_header3", 1), //$NON-NLS-1$ - new TestData("mm_header4", 1), //$NON-NLS-1$ - new TestData("mm_header5", 2), //$NON-NLS-1$ - new TestData("mm_header6", 1), //$NON-NLS-1$ - new TestData("mm_header7", 1), //$NON-NLS-1$ - new TestData("entryOpDupl", 1), //$NON-NLS-1$ - new TestData("resolveIn_ambiguity", 1), //$NON-NLS-1$ - new TestData("bug205303_2", 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug325192", 8, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug268636", 5, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug272869", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug413130", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("bug404647_2", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug414363", 0, 28), //$NON-NLS-1$ - TestData.createSourceChecked("bug401521", 2, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug414616", 2, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug419299", 8, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug414619", 0, 5), //$NON-NLS-1$ - TestData.createSourceChecked("bug415024", 1, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug413391", 10, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug424912", 0, 6), //$NON-NLS-1$ - TestData.createSourceChecked("bug289982_ambiguousLib", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("bug289982_undefinedLib", 0, 1), //$NON-NLS-1$ - TestData.createSourceChecked("bug289982_validation", 7, 7), //$NON-NLS-1$ - TestData.createSourceChecked("bug424584", 11, 0), //$NON-NLS-1$ - new TestData("bug428028", 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug425634", 0, 6), //$NON-NLS-1$ - new TestData("bug433585", 0), //$NON-NLS-1$ - new TestData("bug438038", 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug446375", 2, 0), //$NON-NLS-1$ - TestData.createSourceChecked("bug468303", 0, 1), //$NON-NLS-1$ - }; + } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/QvtLibraryASTTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/QvtLibraryASTTest.java index 2803c1623..d88a9da99 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/QvtLibraryASTTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/QvtLibraryASTTest.java @@ -12,6 +12,7 @@ package org.eclipse.m2m.tests.qvt.oml; import java.io.File; +import java.util.Collections; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; @@ -20,31 +21,25 @@ import org.eclipse.m2m.internal.qvt.oml.expressions.Library; import org.eclipse.m2m.internal.qvt.oml.expressions.ModuleImport; import org.eclipse.m2m.tests.qvt.oml.ParserTests.TestData; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; - +@RunWith(Parameterized.class) public class QvtLibraryASTTest extends TestQvtParser { - private static final String TEST_NAME = "blackboxlibASTmodel"; //$NON-NLS-N$ - - private static TestData createTestData() { - return new TestData(TEST_NAME, 0, 0); + public QvtLibraryASTTest(TestData data) { + super(data); } - public QvtLibraryASTTest(String testName) { - super(createTestData()); - assertEquals(TEST_NAME, testName); - } - - public QvtLibraryASTTest() { - super(createTestData()); //$NON-NLS-1$ - } - - @Override - public void setUp() throws Exception { - super.setUp(); + @Parameters + public static Iterable<TestData> data() { + return Collections.singletonList(new TestData("blackboxlibASTmodel", 0, 0)); //$NON-NLS-N$ } - + @Override + @Test public void runTest() throws Exception { super.runTest(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestExternHelperCall.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestExternHelperCall.java index f6f0c16de..22ab2f05f 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestExternHelperCall.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestExternHelperCall.java @@ -32,6 +32,9 @@ import org.eclipse.m2m.internal.qvt.oml.expressions.Module; import org.eclipse.m2m.internal.qvt.oml.runtime.util.HelperOperationCall; import org.eclipse.m2m.internal.qvt.oml.runtime.util.NonTransformationExecutionContext; import org.eclipse.m2m.tests.qvt.oml.util.TestModuleResolver; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -49,6 +52,7 @@ public class TestExternHelperCall extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -77,10 +81,12 @@ public class TestExternHelperCall extends TestCase { } @Override + @After protected void tearDown() throws Exception { fExecContext.dispose(); } - + + @Test public void testEchoContextual() throws Exception { Object callResult = fCall.invoke("self", new Object[] { "aStringArg", true }); assertEquals("self" + "ASTRINGARG" + "_suffix", callResult); @@ -89,6 +95,7 @@ public class TestExternHelperCall extends TestCase { assertEquals("self" + "aStringArg" + "_suffix", callResult); } + @Test public void testEchoContextless() throws Exception { Object callResult = fCall.invoke(new Object[] { "aStringArg", true }); assertEquals("ASTRINGARG" + "_suffix", callResult); @@ -98,6 +105,7 @@ public class TestExternHelperCall extends TestCase { } + @Test public void testHelperWithAssertFailed() throws Exception { try { Object callResult = fCall.invoke(null); @@ -110,18 +118,20 @@ public class TestExternHelperCall extends TestCase { } } - + @Test public void testNoArgsHelper() throws Exception { final String expectedResult = "testNoArgsHelper"; assertEquals(expectedResult, fCall.invoke(null)); assertEquals(expectedResult, fCall.invoke(new Object[0])); } + @Test public void testHelperWithResolve() throws Exception { final String expectedResult = "testHelperWithResolve"; assertEquals(expectedResult, fCall.invoke(EcoreFactory.eINSTANCE.createEClass(), new Object[0])); } + @Test public void testImportedVirtualCall() throws Exception { // test imported operation call Module mainModule = fCall.getLibrary(); @@ -134,7 +144,7 @@ public class TestExternHelperCall extends TestCase { assertEquals("EClassifier", call.invoke(EcoreFactory.eINSTANCE.createEDataType(), new Object[0])); } - + @Test public void testQueryNonContextual() throws Exception { assertNotNull("Call must refer to operation", fCall.getOperation()); assertNotNull("Call must be imported from a library", fCall.getLibrary()); @@ -143,6 +153,7 @@ public class TestExternHelperCall extends TestCase { assertNull("Non-contextual operation must not have context type", fCall.getContextType()); } + @Test public void testQueryContextual() throws Exception { assertNotNull("Call must refer to operation", fCall.getOperation()); assertNotNull("Call must be imported from a library", fCall.getLibrary()); @@ -154,6 +165,7 @@ public class TestExternHelperCall extends TestCase { /* * Tests the Collection type as the context type */ + @Test public void testToUpperStrings() throws Exception { ArrayList<String> self = new ArrayList<String>(); self.add("aaa"); @@ -172,6 +184,7 @@ public class TestExternHelperCall extends TestCase { * to proper collection at evaluation time - different code location, though * same TypeResolver trouble, perhaps) */ + @Test public void testCollectionTypeInImportsMatch() throws Exception { assertTrue(fCall.isContextual()); Object result = fCall.invoke("anything", new Object[0]); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestLaunchConfiguration.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestLaunchConfiguration.java index 221125b24..16d991083 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestLaunchConfiguration.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestLaunchConfiguration.java @@ -20,6 +20,9 @@ import org.eclipse.m2m.internal.qvt.oml.common.launch.TargetUriData; import org.eclipse.m2m.internal.qvt.oml.common.launch.TargetUriData.TargetType; import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchConfigurationDelegate; import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -36,27 +39,33 @@ public class TestLaunchConfiguration extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); } @Override + @After protected void tearDown() throws Exception { super.tearDown(); } + @Test public void testEmptyEmpty() throws Throwable { performTest("", "", TargetType.NEW_MODEL); //$NON-NLS-1$//$NON-NLS-2$ } + @Test public void testEcoreNew() throws Throwable { performTest(IN_ECORE, OUT_ECORE_NEW, TargetType.NEW_MODEL); } + @Test public void testEcoreInplace() throws CoreException { performTest(INOUT_ECORE, "", TargetType.NEW_MODEL); //$NON-NLS-1$ } - + + @Test public void testEcoreExsisting() throws CoreException { performTest(IN_ECORE, OUT_ECORE_EXISTING, TargetType.NEW_MODEL); } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestMetamodelRegistry.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestMetamodelRegistry.java index c9eb682f3..0f693a3b6 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestMetamodelRegistry.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestMetamodelRegistry.java @@ -40,6 +40,9 @@ import org.eclipse.m2m.internal.qvt.oml.emf.util.urimap.MappingContainer; import org.eclipse.m2m.internal.qvt.oml.emf.util.urimap.MetamodelURIMappingHelper; import org.eclipse.m2m.internal.qvt.oml.emf.util.urimap.URIMapping; import org.eclipse.m2m.internal.qvt.oml.project.QVTOProjectPlugin; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -54,6 +57,7 @@ public class TestMetamodelRegistry extends TestCase { private MetamodelRegistry metamodelRegistry; @Override + @Before public void setUp() throws Exception { myProject = new TestProject("MModelREgistryTest", new String[] {QVTOProjectPlugin.NATURE_ID}); //$NON-NLS-1$ @@ -97,10 +101,12 @@ public class TestMetamodelRegistry extends TestCase { } @Override + @After public void tearDown() throws Exception { myProject.delete(); } - + + @Test public void testProjectContextRegistration() throws Exception { IMetamodelRegistryProvider.IRepositoryContext ctx = createContext(); @@ -111,7 +117,8 @@ public class TestMetamodelRegistry extends TestCase { EPackage ePackage = metamodelDesc.getModel(); assertEquals(ePackage.eResource().getURI(), testEcoreFileURI); } - + + @Test public void testGlobalContextRegistration() throws Exception { String knownID = EcorePackage.eINSTANCE.getNsURI(); IMetamodelDesc metamodelDesc = metamodelRegistry.getMetamodelDesc(knownID); @@ -119,6 +126,7 @@ public class TestMetamodelRegistry extends TestCase { assertSame(EcorePackage.eINSTANCE, metamodelDesc.getModel()); } + @Test public void testNestedPackageRegistration() throws Exception { IMetamodelRegistryProvider.IRepositoryContext ctx = createContext(); @@ -131,6 +139,7 @@ public class TestMetamodelRegistry extends TestCase { assertEquals(ePackage.getName(), NESTED_PACKAGE_NAME); } + @Test public void testBug376644PackageRegistryFallback() throws Exception { IMetamodelRegistryProvider.IRepositoryContext ctx = createContext(); @@ -143,6 +152,7 @@ public class TestMetamodelRegistry extends TestCase { assertSame(EcorePackage.eINSTANCE, ePackage); } + @Test public void testBug441094DelegatePackageRegistry() { EPackage myEPackage = EcoreFactory.eINSTANCE.createEPackage(); @@ -159,6 +169,7 @@ public class TestMetamodelRegistry extends TestCase { assertSame(myEPackage, result); } + @Test public void testBug326651UpdateMetamodel() throws Exception { final String ID = "myPackageID"; @@ -180,6 +191,7 @@ public class TestMetamodelRegistry extends TestCase { } + @Test public void testBug435699IllegalRegistration() throws Exception { final String ID = "myPackageID"; diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLAnnotationSupport.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLAnnotationSupport.java index 7c63a6403..0292a9857 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLAnnotationSupport.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLAnnotationSupport.java @@ -22,6 +22,8 @@ import org.eclipse.emf.ecore.EParameter; import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.m2m.internal.qvt.oml.evaluator.OCLAnnotationSupport; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -40,6 +42,7 @@ public class TestOCLAnnotationSupport extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -53,6 +56,7 @@ public class TestOCLAnnotationSupport extends TestCase { subFooClass = createClass("SubFoo", new EClass[] { fooClass }); } + @Test public void testDirectlyInherited() throws Exception { EOperation superOperation = createOperation(fooClass, "oper", new EClassifier[0]); //$NON-NLS-1$ @@ -75,6 +79,7 @@ public class TestOCLAnnotationSupport extends TestCase { assertSame(siblingSuperOperation, resolvedSiblingSuperOperation); } + @Test public void testIndirectlyInherited() throws Exception { EOperation operation = createOperation(superFooClass, "oper", new EClassifier[0]); //$NON-NLS-1$ @@ -100,6 +105,7 @@ public class TestOCLAnnotationSupport extends TestCase { assertSame(siblingSuperOperation, resolvedSiblingSuperOperation); } + @Test public void testOverrideInherited() throws Exception { EOperation referencedSuperFooOperation = createOperation(superFooClass, "oper", new EClassifier[0]); //$NON-NLS-1$ // override operation from Foo in SubFoo @@ -131,6 +137,7 @@ public class TestOCLAnnotationSupport extends TestCase { } } + @Test public void testOperationMatch() throws Exception { // add confusing similar signature operations String sharedName = "oper"; //$NON-NLS-1$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLSemantics.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLSemantics.java index 29139d791..1aa5bcaf9 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLSemantics.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestOCLSemantics.java @@ -35,6 +35,7 @@ import org.eclipse.ocl.ecore.OCL; import org.eclipse.ocl.ecore.OCLExpression; import org.eclipse.ocl.ecore.SendSignalAction; import org.eclipse.ocl.expressions.IntegerLiteralExp; +import org.junit.Test; import junit.framework.TestCase; @@ -49,7 +50,8 @@ public class TestOCLSemantics extends TestCase { public TestOCLSemantics(String name) { super(name); } - + + @Test public void testImpliesRightPartCalled() throws Exception { OCLExpression expression = createExpression("true implies 1 <> 1", EcorePackage.eINSTANCE.getEString()); Object result = checkedEvaluate(null, expression); @@ -58,6 +60,7 @@ public class TestOCLSemantics extends TestCase { assertTrue(Boolean.FALSE.equals(result)); } + @Test public void testImpliesRightPartSkipped() throws Exception { OCLExpression expression = createExpression("false implies 1 <> 1", EcorePackage.eINSTANCE.getEString()); Object result = checkedEvaluate(null, expression); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestParsingMACLineBreaks.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestParsingMACLineBreaks.java index 091dee6b6..08cf20428 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestParsingMACLineBreaks.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestParsingMACLineBreaks.java @@ -17,6 +17,7 @@ import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalEnvFactory; import org.eclipse.m2m.internal.qvt.oml.ast.parser.QvtOperationalParser; import org.eclipse.m2m.internal.qvt.oml.cst.parser.QVTOLexer; import org.eclipse.ocl.ParserException; +import org.junit.Test; import junit.framework.TestCase; @@ -25,7 +26,8 @@ public class TestParsingMACLineBreaks extends TestCase { public TestParsingMACLineBreaks(String name) { super(name); } - + + @Test public void testBreakLastChar() throws Exception { String contents = "abc;\r"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); @@ -34,6 +36,7 @@ public class TestParsingMACLineBreaks extends TestCase { assertEquals(lineCount, 1); } + @Test public void testBreakWinLastBreak() throws Exception { String contents = "abc;\r\n"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); @@ -42,6 +45,7 @@ public class TestParsingMACLineBreaks extends TestCase { assertEquals(lineCount, 1); } + @Test public void testBreakUnixLastBreak() throws Exception { String contents = "abc;\n"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); @@ -50,6 +54,7 @@ public class TestParsingMACLineBreaks extends TestCase { assertEquals(lineCount, 1); } + @Test public void testMixed() throws Exception { String contents = "a\n \r \r\n"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); @@ -58,6 +63,7 @@ public class TestParsingMACLineBreaks extends TestCase { assertEquals(lineCount, 3); } + @Test public void testBreakFirstChar() throws Exception { String contents = "\rabc;"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); @@ -66,6 +72,7 @@ public class TestParsingMACLineBreaks extends TestCase { assertEquals(lineCount, 1); } + @Test public void testBreakWinFirstBreak() throws Exception { String contents = "\r\nabc;"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); @@ -74,6 +81,7 @@ public class TestParsingMACLineBreaks extends TestCase { assertEquals(lineCount, 1); } + @Test public void testBreakUnixFirstBreak() throws Exception { String contents = "\nabc;"; //$NON-NLS-1$ QVTOLexer lexer = createLexer(contents); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtBuilder.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtBuilder.java index 60332ee4e..a8a0030e9 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtBuilder.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtBuilder.java @@ -22,6 +22,9 @@ import org.eclipse.m2m.internal.qvt.oml.common.MDAConstants; import org.eclipse.m2m.internal.qvt.oml.project.QVTOProjectPlugin; import org.eclipse.m2m.internal.qvt.oml.project.builder.QVTOBuilderConfig; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -32,6 +35,7 @@ import junit.framework.TestCase; public class TestQvtBuilder extends TestCase { @Override + @Before public void setUp() throws Exception { TestUtil.turnOffAutoBuilding(); @@ -43,11 +47,12 @@ public class TestQvtBuilder extends TestCase { } @Override + @After public void tearDown() throws Exception { myProject.delete(); } - + @Test public void testFullBuild() throws Exception { TestUtil.buildProject(myProject.project); IFile qvtFile = myProject.project.getFile("/Simpleuml_To_Rdb" + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT); //$NON-NLS-1$ @@ -65,6 +70,7 @@ public class TestQvtBuilder extends TestCase { qvtFile.findMarkers(QVTOProjectPlugin.PROBLEM_MARKER, true, IResource.DEPTH_INFINITE).length > 0); } + @Test public void testClean() throws Exception { TestUtil.buildProject(myProject.project); TestUtil.buildProject(myProject.project, IncrementalProjectBuilder.CLEAN_BUILD); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtParser.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtParser.java index e42fe36aa..b0adb7fbb 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtParser.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtParser.java @@ -17,6 +17,7 @@ import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -44,28 +45,181 @@ import org.eclipse.m2m.internal.qvt.oml.runtime.project.TransformationUtil; import org.eclipse.m2m.tests.qvt.oml.ParserTests.TestData; import org.eclipse.m2m.tests.qvt.oml.util.ProblemSourceAnnotationHelper; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import junit.framework.TestCase; /** * @author pkobiakov */ +@RunWith(Parameterized.class) public class TestQvtParser extends TestCase { - - public TestQvtParser(String testName) { - this(ParserTests.getTestData(testName)); - } - + public TestQvtParser(TestData data) { super(data.getDir()); myData = data; } + @Parameters(name="{0}") + public static Iterable<TestData> data() { + return Arrays.asList( + new TestData[] { + TestData.createSourceChecked("abstractout", 3, 0), //$NON-NLS-1$ + TestData.createSourceChecked("collectionAssignment", 4, 0), //$NON-NLS-1$ + TestData.createSourceChecked("overload_multipleParams", 0, 19), //$NON-NLS-1$ + TestData.createSourceChecked("overload_singleParam", 0, 0), //$NON-NLS-1$ + TestData.createSourceChecked("mainInLibrary", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("dynamicpackage", 0, 0), //$NON-NLS-1$ + TestData.createSourceChecked("importedInstances", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("moduleElementErrorRecovery_265452", 7, 0), //$NON-NLS-1$ + TestData.createSourceChecked("unitElementErrorRecovery_264517_1", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("unitElementErrorRecovery_264517_2", 3, 0), //$NON-NLS-1$ + TestData.createSourceChecked("unitElementErrorRecovery_264675", 3, 0), //$NON-NLS-1$ + TestData.createSourceChecked("nestedPropertiesAssignment_262757", 7, 0), //$NON-NLS-1$ + TestData.createSourceChecked("collectionOperationNotFound_224093", 3, 0), //$NON-NLS-1$ + TestData.createSourceChecked("deprecated_importLocation", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("misplacedTopElements", 0, 4), //$NON-NLS-1$ + TestData.createSourceChecked("escape_sequences_250630", 4, 0), //$NON-NLS-1$ + TestData.createSourceChecked("multiline_strings_262733", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("deprecated_rename", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("varInitExpWithResult_261623", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("_while_261024", 4, 0), //$NON-NLS-1$ + TestData.createSourceChecked("listtype", 7, 0), //$NON-NLS-1$ + TestData.createSourceChecked("listtype2", 7, 0), //$NON-NLS-1$ + //new TestData("orderedsetdoesnotconformtoset", 1), //$NON-NLS-1$ + TestData.createSourceChecked("computeExp_252269", 3, 1), //$NON-NLS-1$ + new TestData("implicitsource_ocl_234354", 7, 0), //$NON-NLS-1$ + TestData.createSourceChecked("duplicateModelTypeDef", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("blackboxlib_annotation_java", 1, 2), //$NON-NLS-1$ + TestData.createSourceChecked("dupImportFileUnit", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("dupImportLibrary", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("testmodelparamtype", 3, 0), //$NON-NLS-1$ + TestData.createSourceChecked("resolvecond", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("intermPropClash", 9, 0), //$NON-NLS-1$ + TestData.createSourceChecked("noClassInImplicitPopulate", 3, 1), //$NON-NLS-1$ + TestData.createSourceChecked("parmnamesclash", 22, 1), //$NON-NLS-1$ + TestData.createSourceChecked("stdlibElementAsOut", 7, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug2732_wrongcondition", 1, 1), //$NON-NLS-1$ + TestData.createSourceChecked("varscope", 10, 0), //$NON-NLS-1$ + TestData.createSourceChecked("_while", 12, 0), //$NON-NLS-1$ + TestData.createSourceChecked("implicitCallSrc", 16, 6), //$NON-NLS-1$ + TestData.createSourceChecked("libraryWithModuleElements", 2, 0), //$NON-NLS-1$ + new TestData("assert_log", 0), //$NON-NLS-1$ + new TestData("opersignatureparamclash", 1), //$NON-NLS-1$ + new TestData("collectreturntype", 0), //$NON-NLS-1$ + new TestData("nocollectoncollection", 0), //$NON-NLS-1$ + ///Commented out, due to migration to OCL 1.2, TODO - clarify the current error reporting with MDT, seems to be incorrect + // new TestData("nonstaticcallinstaticcontext", 1), //$NON-NLS-1$ + new TestData("virtrettypemismatch", 1), //$NON-NLS-1$ + new TestData("missinglibmmimport", 1), //$NON-NLS-1$ + new TestData("noglobalallinstances", 0), //$NON-NLS-1$ + new TestData("imp", 0), //$NON-NLS-1$ // TODO: independent parsing for imports + new TestData("imp2", 0), //$NON-NLS-1$ + new TestData("imp3", 0), //$NON-NLS-1$ + TestData.createSourceChecked("impError", 3, 0), //$NON-NLS-1$ + new TestData("assignereadonlyprop", 1), //$NON-NLS-1$ + new TestData("nonbooleanguard", 1), //$NON-NLS-1$ + TestData.createSourceChecked("sameparamname", 2, 0), //$NON-NLS-1$ + new TestData("badtype", 1), //$NON-NLS-1$ + new TestData("simple", 0), //$NON-NLS-1$ + new TestData("selfimport", 1), //$NON-NLS-1$ + new TestData("normalimport", 0), //$NON-NLS-1$ + new TestData("missingmappingcall", 1), //$NON-NLS-1$ + new TestData("missingfeature", 1), //$NON-NLS-1$ + new TestData("featuretypemismatch", 1), //$NON-NLS-1$ + new TestData("initvariable", 1), //$NON-NLS-1$ + new TestData("missingvariablereference", 1), //$NON-NLS-1$ + new TestData("optionalout", 0), //$NON-NLS-1$ + new TestData("nonassignableout", 1), //$NON-NLS-1$ + TestData.createSourceChecked("wrongout", 3, 0), //$NON-NLS-1$ + new TestData("outininitvar", 0), //$NON-NLS-1$ + new TestData("modifyfeature", 0), //$NON-NLS-1$ + new TestData("missingout", 2), //$NON-NLS-1$ + new TestData("modifyfeatureerror", 2), //$NON-NLS-1$ + new TestData("bodywithsemicolon", 0), //$NON-NLS-1$ + new TestData("modifyparam", 0), //$NON-NLS-1$ + TestData.createSourceChecked("wrongparamnameinout", 2, 0), //$NON-NLS-1$ + new TestData("modifyfeatureininiterror", 2), //$NON-NLS-1$ + TestData.createSourceChecked("voidout", 2, 0), //$NON-NLS-1$ + new TestData("modifyinparam", 1), //$NON-NLS-1$ + new TestData("modifyresult", 0), //$NON-NLS-1$ + new TestData("wrongorderininit", 1), //$NON-NLS-1$ + new TestData("duplicateinitvariable", 1), //$NON-NLS-1$ + TestData.createSourceChecked("missingObjectType", 1, 0), // replaced former 'nestedouterror' //$NON-NLS-1$ + new TestData("emptyinit", 0), //$NON-NLS-1$ + new TestData("assignresultininit", 0), //$NON-NLS-1$ + new TestData("assign_inoutParam", 2), //$NON-NLS-1$ + new TestData("assign_inParam", 2), //$NON-NLS-1$ + new TestData("assign_varThis", 1), //$NON-NLS-1$ + + new TestData("errorinexpressionlist", 1), //$NON-NLS-1$ + new TestData("largefile", 0), //$NON-NLS-1$ + new TestData("calldump", 0), //$NON-NLS-1$ + new TestData("missingparamname", 2), //$NON-NLS-1$ + new TestData("nameclash", 1), //$NON-NLS-1$ + new TestData("emptymodule", 0), //$NON-NLS-1$ + new TestData("props", 0), //$NON-NLS-1$ + new TestData("duplicatelocalproperty", 1), //$NON-NLS-1$ + new TestData("wrongorderinproperty", 1), //$NON-NLS-1$ + new TestData("implicitpopulation", 0), //$NON-NLS-1$ + new TestData("implicitpopulationwithinit", 0), //$NON-NLS-1$ + new TestData("mapkeyword", 0), //$NON-NLS-1$ + new TestData("endsectfull", 0), //$NON-NLS-1$ + new TestData("endsectimplicitpopulation", 0), //$NON-NLS-1$ + new TestData("endsectimplicitpopulationnoinit", 0), //$NON-NLS-1$ + new TestData("endsectinitnopopulation", 0), //$NON-NLS-1$ + new TestData("endsectonly", 0), //$NON-NLS-1$ + new TestData("endsectpopulationnoinit", 0), //$NON-NLS-1$ + new TestData("configpropstype", 0), //$NON-NLS-1$ + + new TestData("mm_header1", 1), //$NON-NLS-1$ + new TestData("mm_header2", 1), //$NON-NLS-1$ + new TestData("mm_header3", 1), //$NON-NLS-1$ + new TestData("mm_header4", 1), //$NON-NLS-1$ + new TestData("mm_header5", 2), //$NON-NLS-1$ + new TestData("mm_header6", 1), //$NON-NLS-1$ + new TestData("mm_header7", 1), //$NON-NLS-1$ + new TestData("entryOpDupl", 1), //$NON-NLS-1$ + new TestData("resolveIn_ambiguity", 1), //$NON-NLS-1$ + new TestData("bug205303_2", 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug325192", 8, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug268636", 5, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug272869", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug413130", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("bug404647_2", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug414363", 0, 28), //$NON-NLS-1$ + TestData.createSourceChecked("bug401521", 2, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug414616", 2, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug419299", 8, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug414619", 0, 5), //$NON-NLS-1$ + TestData.createSourceChecked("bug415024", 1, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug413391", 10, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug424912", 0, 6), //$NON-NLS-1$ + TestData.createSourceChecked("bug289982_ambiguousLib", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("bug289982_undefinedLib", 0, 1), //$NON-NLS-1$ + TestData.createSourceChecked("bug289982_validation", 7, 7), //$NON-NLS-1$ + TestData.createSourceChecked("bug424584", 11, 0), //$NON-NLS-1$ + new TestData("bug428028", 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug425634", 0, 6), //$NON-NLS-1$ + new TestData("bug433585", 0), //$NON-NLS-1$ + new TestData("bug438038", 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug446375", 2, 0), //$NON-NLS-1$ + TestData.createSourceChecked("bug468303", 0, 1), //$NON-NLS-1$ + } + ); + } + protected CompiledUnit[] getCompiledResults() { return myCompiled; } @Override + @Before public void setUp() throws Exception { TestUtil.turnOffAutoBuilding(); @@ -77,6 +231,7 @@ public class TestQvtParser extends TestCase { } @Override + @After public void tearDown() throws Exception { myCompiled = null; File destinationFolder = getDestinationFolder(); @@ -90,6 +245,7 @@ public class TestQvtParser extends TestCase { } @Override + @Test public void runTest() throws Exception { copyData("sources/" + myData.getDir(), "parserTestData/sources/" + myData.getDir()); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtResourceFactory.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtResourceFactory.java index 61bbda2bf..69b8e5072 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtResourceFactory.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestQvtResourceFactory.java @@ -12,6 +12,7 @@ package org.eclipse.m2m.tests.qvt.oml; +import java.util.Arrays; import java.util.Collections; import org.eclipse.core.runtime.IPath; @@ -22,59 +23,44 @@ import org.eclipse.m2m.internal.qvt.oml.expressions.Module; import org.eclipse.m2m.tests.qvt.oml.transform.FileToFileData; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; import org.eclipse.m2m.tests.qvt.oml.transform.TestTransformation; - -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko * */ +@RunWith(Parameterized.class) public class TestQvtResourceFactory extends TestTransformation { - - public static Test suite() { - TestSuite suite = new TestSuite("QVTO EMF Resource"); //$NON-NLS-1$ - - suite.addTest(new TestQvtResourceFactory("abstractresult") { //$NON-NLS-1$ - - @Override - protected void runTest() throws Throwable { - IPath filePath = getProject().getFullPath().append(ModelTestData.MODEL_FOLDER).append(getName()) - .append(getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT); - checkResourceByUri(URI.createPlatformResourceURI(filePath.toString(), true)); - } - - }); - - suite.addTest(new TestQvtResourceFactory("abstractresult") { //$NON-NLS-1$ - - @Override - protected void runTest() throws Throwable { - String testFile = "org.eclipse.m2m.tests.qvt.oml/parserTestData/models/" + getName() + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT; - checkResourceByUri(URI.createPlatformPluginURI(testFile, false)); - } - - }); - - suite.addTest(new TestQvtResourceFactory("errorinexpressionlist") { //$NON-NLS-1$ - - @Override - protected void runTest() throws Throwable { - IPath filePath = getProject().getFullPath().append(ModelTestData.MODEL_FOLDER).append(getName()) - .append(getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT); - checkResourceByUri(URI.createPlatformResourceURI(filePath.toString(), true)); - } - - }); - - return suite; - } - - public TestQvtResourceFactory(String dataName) { + + public TestQvtResourceFactory(String dataName) { super(new FileToFileData(dataName)); } - + + @Parameters(name="{0}") + public static Iterable<String> data() { + return Arrays.asList( + "abstractresult", + "errorinexpressionlist" + ); + } + + @Test + public void runTest1() throws Throwable { + IPath filePath = getProject().getFullPath().append(ModelTestData.MODEL_FOLDER).append(getName()) + .append(getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT); + checkResourceByUri(URI.createPlatformResourceURI(filePath.toString(), true)); + } + + @Test + public void runTest2() throws Throwable { + String testFile = "org.eclipse.m2m.tests.qvt.oml/parserTestData/models/" + getName() + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT; + checkResourceByUri(URI.createPlatformPluginURI(testFile, false)); + } + private static void checkResourceByUri(URI scriptUri) throws Exception { Resource resource = Resource.Factory.Registry.INSTANCE.getFactory(scriptUri).createResource(scriptUri); resource.load(Collections.emptyMap()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestSamples.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestSamples.java index ae7afa57f..ba3dba9fe 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestSamples.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/TestSamples.java @@ -19,22 +19,17 @@ import org.eclipse.m2m.internal.qvt.oml.samples.ui.SampleProjectsCreationOperati import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; +import org.junit.Test; import junit.framework.TestCase; public class TestSamples extends TestCase { - public TestSamples() { - } - @Override - public void setUp() throws Exception { + public TestSamples() { } - @Override - public void tearDown() throws Exception { - } - + @Test public void testUml2Rdb() throws Exception { checkSample("org.eclipse.m2m.qvt.oml.samples.simpleuml2rdb", "samples/simpleuml2rdb.zip", OML_SAMPLES_PLUGIN); //$NON-NLS-1$ //$NON-NLS-2$ } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/QvtAntScriptTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/QvtAntScriptTests.java deleted file mode 100644 index 1ce1ec224..000000000 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/QvtAntScriptTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2014 Borland Software Corporation 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: - * Borland Software Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.m2m.tests.qvt.oml.ant; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.m2m.tests.qvt.oml.AllTests; -import org.eclipse.m2m.tests.qvt.oml.transform.FilesToFilesData; -import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; -import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author sboyko - */ -public class QvtAntScriptTests { - public static Test suite() { - return interpreterSuite(); - } - - public static TestSuite interpreterSuite() { - TestSuite suite = new TestSuite("QVT interpreter from Ant"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - for (ModelTestData data : datas) { - suite.addTest(new TestQvtAntScript(data)); - } - - return suite; - } - - public static ModelTestData[] createTestData() { - return new ModelTestData[] { - new AntModelTestData("simple", Collections.<String>emptyList(), Arrays.asList("expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ - new AntModelTestData("twomodels", Collections.<String>emptyList(), Arrays.asList("expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ - new AntModelTestData("twomodels_new", Collections.<String>emptyList(), Arrays.asList("expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ - }; - } - - private static class AntModelTestData extends FilesToFilesData { - public AntModelTestData(String name, List<String> fromFiles, List<String> expectedFiles) { - super(name, fromFiles, expectedFiles); - } - - @Override - protected File getDestFolder(IProject project) { - try { - return AntModelTestData.getDestFolder(getName(), project); - } - catch(IOException e) { - throw new RuntimeException(e); - } - } - - private static File getDestFolder(String name, IProject project) throws IOException { - File srcRootFolder = TestUtil.getPluginRelativeFile(AllTests.BUNDLE_ID, TestQvtAntScript.ROOT_DIR_NAME); - File srcFolder = AntModelTestData.getFolder(srcRootFolder, name); - File destFolder = AntModelTestData.getFolder(new File(project.getLocation().toString() + "/models/"), srcFolder.getName()); //$NON-NLS-1$ - return destFolder; - } - - private static File getFolder(File folder, final String expectedName) { - File dir = new File(folder, expectedName); - if(!dir.exists() || !dir.isDirectory()) { - throw new IllegalArgumentException("Invalid directory: " + dir); //$NON-NLS-1$ - } - - return dir; - } - } -} diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/TestQvtAntScript.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/TestQvtAntScript.java index a917b645e..0d82d51de 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/TestQvtAntScript.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ant/TestQvtAntScript.java @@ -14,6 +14,10 @@ package org.eclipse.m2m.tests.qvt.oml.ant; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.eclipse.ant.core.AntRunner; import org.eclipse.core.resources.IFile; @@ -32,14 +36,22 @@ import org.eclipse.m2m.internal.qvt.oml.emf.util.EmfUtil; import org.eclipse.m2m.internal.qvt.oml.emf.util.ModelContent; import org.eclipse.m2m.tests.qvt.oml.AllTests; import org.eclipse.m2m.tests.qvt.oml.TestProject; +import org.eclipse.m2m.tests.qvt.oml.transform.FilesToFilesData; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import junit.framework.TestCase; /** * @author sboyko */ +@RunWith(Parameterized.class) public class TestQvtAntScript extends TestCase { public static final String ROOT_DIR_NAME = "antTestData"; //$NON-NLS-1$ @@ -50,7 +62,17 @@ public class TestQvtAntScript extends TestCase { myData = data; } + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.<ModelTestData>asList( + new AntModelTestData("simple", Collections.<String>emptyList(), Arrays.asList("expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ + new AntModelTestData("twomodels", Collections.<String>emptyList(), Arrays.asList("expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ + new AntModelTestData("twomodels_new", Collections.<String>emptyList(), Arrays.asList("expected.rdb")) //$NON-NLS-1$ //$NON-NLS-2$ + ); + } + @Override + @Test public void runTest() throws Exception { IFile script = getIFile("composite.xml"); //$NON-NLS-1$ @@ -80,6 +102,7 @@ public class TestQvtAntScript extends TestCase { } @Override + @Before public void setUp() throws Exception { TestUtil.turnOffAutoBuilding(); @@ -94,6 +117,7 @@ public class TestQvtAntScript extends TestCase { } @Override + @After public void tearDown() throws Exception { //+myProject.delete(); } @@ -136,6 +160,38 @@ public class TestQvtAntScript extends TestCase { } private final ModelTestData myData; - private TestProject myProject; + private TestProject myProject; + + private static class AntModelTestData extends FilesToFilesData { + public AntModelTestData(String name, List<String> fromFiles, List<String> expectedFiles) { + super(name, fromFiles, expectedFiles); + } + + @Override + protected File getDestFolder(IProject project) { + try { + return AntModelTestData.getDestFolder(getName(), project); + } + catch(IOException e) { + throw new RuntimeException(e); + } + } + + private static File getDestFolder(String name, IProject project) throws IOException { + File srcRootFolder = TestUtil.getPluginRelativeFile(AllTests.BUNDLE_ID, TestQvtAntScript.ROOT_DIR_NAME); + File srcFolder = AntModelTestData.getFolder(srcRootFolder, name); + File destFolder = AntModelTestData.getFolder(new File(project.getLocation().toString() + "/models/"), srcFolder.getName()); //$NON-NLS-1$ + return destFolder; + } + + private static File getFolder(File folder, final String expectedName) { + File dir = new File(folder, expectedName); + if(!dir.exists() || !dir.isDirectory()) { + throw new IllegalArgumentException("Invalid directory: " + dir); //$NON-NLS-1$ + } + + return dir; + } + } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/AllCallAPITests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/AllCallAPITests.java index 3521176f8..5fbc49bc2 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/AllCallAPITests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/AllCallAPITests.java @@ -11,28 +11,23 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.callapi; -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; +@RunWith(Suite.class) +@SuiteClasses({ + BasicModelExtentTest.class, + InvocationTest.class, + InvocationExtTest.class, + DynamicModelInvocationTest.class, + DynamicRegisteredModelInvocationTest.class, + ChildInTreeInputInvocationTest.class, + Bug431055.class, + TransformationExecutorWithVisitorDecoratorTest.class, + IncrementalUpdateExecutorTest.class, + BlackboxModuleStandaloneSetupTest.class +}) public class AllCallAPITests { - public static Test suite() { - TestSuite suite = new TestSuite("Test for org.eclipse.m2m.tests.qvt.oml.callapi"); //$NON-NLS-1$ - //$JUnit-BEGIN$ - suite.addTestSuite(BasicModelExtentTest.class); - suite.addTestSuite(InvocationTest.class); - suite.addTestSuite(InvocationExtTest.class); - suite.addTestSuite(DynamicModelInvocationTest.class); - suite.addTestSuite(DynamicRegisteredModelInvocationTest.class); - suite.addTestSuite(ChildInTreeInputInvocationTest.class); - suite.addTestSuite(Bug431055.class); - suite.addTest(new TransformationExecutorWithVisitorDecoratorTest()); - suite.addTest(new IncrementalUpdateExecutorTest()); - suite.addTest(new BlackboxModuleStandaloneSetupTest("bug326871_standalone")); //$NON-NLS-1$ - suite.addTest(new BlackboxModuleStandaloneSetupTest("bug326871a_standalone")); //$NON-NLS-1$ - - //$JUnit-END$ - return suite; - } - } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BasicModelExtentTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BasicModelExtentTest.java index 57a7e967b..8de57ea16 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BasicModelExtentTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BasicModelExtentTest.java @@ -18,6 +18,8 @@ import java.util.List; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.m2m.qvt.oml.BasicModelExtent; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -39,6 +41,7 @@ public class BasicModelExtentTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -49,6 +52,7 @@ public class BasicModelExtentTest extends TestCase { fInContents.add(fP2); } + @Test public void testAddition() throws Exception { BasicModelExtent in = new BasicModelExtent(); assertTrue(in.getContents().isEmpty()); @@ -57,6 +61,7 @@ public class BasicModelExtentTest extends TestCase { assertFalse(in.getContents().isEmpty()); } + @Test public void testSet() throws Exception { BasicModelExtent in = new BasicModelExtent(fInContents); assertEquals(2, in.getContents().size()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BlackboxModuleStandaloneSetupTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BlackboxModuleStandaloneSetupTest.java index f581603e9..14eecd0c3 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BlackboxModuleStandaloneSetupTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/BlackboxModuleStandaloneSetupTest.java @@ -11,26 +11,37 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.callapi; +import java.util.Arrays; import java.util.Collections; import org.eclipse.m2m.qvt.oml.TransformationExecutor; import org.eclipse.m2m.tests.qvt.oml.bbox.StandaloneBBoxModule2; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class BlackboxModuleStandaloneSetupTest extends TransformationExecutorTest { public BlackboxModuleStandaloneSetupTest(String name) { super(name, Collections.<String>emptyList()); } + @Parameters + public static Iterable<String> data() { + return Arrays.asList( + new String[] { + "bug326871_standalone", //$NON-NLS-1$ + "bug326871a_standalone" //$NON-NLS-1$ + } + ); + } + @Override - protected void setUp() { + @Before + public void setUp() { TransformationExecutor.BlackboxRegistry.INSTANCE.registerModules(StandaloneBBoxModule2.class); super.setUp(); - } - - @Override - protected void runTest() throws Throwable { - super.runTest(); - } - + } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/Bug431055.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/Bug431055.java index d8b7ff8f1..c38d1e2ed 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/Bug431055.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/Bug431055.java @@ -10,6 +10,8 @@ import org.eclipse.m2m.qvt.oml.BasicModelExtent; import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -23,6 +25,7 @@ public class Bug431055 extends TestCase { TransformationExecutor executor; @Override + @Before protected void setUp() { URI modelUri = URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvt.oml/deployed/callapi/Bug431055.ecore", //$NON-NLS-1$ true); @@ -49,6 +52,7 @@ public class Bug431055 extends TestCase { * ModelParameterExtent's constructor) * */ + @Test public void testInoutWithResource() { assertEquals(resource, object.eResource()); ExecutionDiagnostic diagnostic = executor.execute(new ExecutionContextImpl(), modelExtent); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/ChildInTreeInputInvocationTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/ChildInTreeInputInvocationTest.java index d9a755e09..a693664f8 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/ChildInTreeInputInvocationTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/ChildInTreeInputInvocationTest.java @@ -27,6 +27,8 @@ import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.ModelExtent; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -47,6 +49,7 @@ public class ChildInTreeInputInvocationTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -83,6 +86,7 @@ public class ChildInTreeInputInvocationTest extends TestCase { } + @Test public void testInvokeSuccess() throws Exception { final ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); assertEquals(Diagnostic.OK, diagnostic.getSeverity()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DebugExecutorTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DebugExecutorTest.java index 967876f26..1ca2952e5 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DebugExecutorTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DebugExecutorTest.java @@ -13,6 +13,7 @@ package org.eclipse.m2m.tests.qvt.oml.callapi; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -44,11 +45,18 @@ import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.debug.core.launch.TransformationRunnerFactory; import org.eclipse.m2m.tests.qvt.oml.TestProject; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.TransformTests; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import junit.framework.TestCase; - +@RunWith(Parameterized.class) public class DebugExecutorTest extends TestCase { private ModelTestData myData; @@ -66,8 +74,14 @@ public class DebugExecutorTest extends TestCase { myData = data; } + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.asList(TransformTests.createTestData()); + } + @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { TestUtil.turnOffAutoBuilding(); String name = DebugExecutorTest.class.getSimpleName(); @@ -117,7 +131,8 @@ public class DebugExecutorTest extends TestCase { } @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { if (myData == null) { return; } @@ -134,7 +149,8 @@ public class DebugExecutorTest extends TestCase { * Test if transformation can be successfully executed when running via TransformationRunner. */ @Override - protected void runTest() throws Throwable { + @Test + public void runTest() throws Throwable { TransformationRunner runner = factory.createRunner(); URI traceUri = getTraceUri(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicModelInvocationTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicModelInvocationTest.java index 21020d9c9..b1afe70cf 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicModelInvocationTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicModelInvocationTest.java @@ -25,6 +25,8 @@ import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.ModelExtent; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -46,6 +48,7 @@ public class DynamicModelInvocationTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -84,7 +87,8 @@ public class DynamicModelInvocationTest extends TestCase { fExecutor = new TransformationExecutor(transfURI, registry); } - + + @Test public void testDynamicModelInput() throws Exception { final ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput); assertEquals(Diagnostic.OK, diagnostic.getSeverity()); @@ -99,6 +103,7 @@ public class DynamicModelInvocationTest extends TestCase { assertEquals(3, fInput.getContents().size()); } + @Test public void testDynamicModelInputInMemoryOnly() throws Exception { ModelExtent input = fInMemoryOnlyInput; diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicRegisteredModelInvocationTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicRegisteredModelInvocationTest.java index 40c480aa9..9150e689c 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicRegisteredModelInvocationTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/DynamicRegisteredModelInvocationTest.java @@ -25,6 +25,8 @@ import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.ModelExtent; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -45,6 +47,7 @@ public class DynamicRegisteredModelInvocationTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -81,7 +84,8 @@ public class DynamicRegisteredModelInvocationTest extends TestCase { fDynamicPackageRegistry = new EPackageRegistryImpl(); fDynamicPackageRegistry.put(dynPackage.getNsURI(), dynPackage); } - + + @Test public void testDynamicRegisteredModelInput() throws Exception { TransformationExecutor executor = new TransformationExecutor(fTransfURI); final ExecutionDiagnostic diagnostic = executor.execute(fContext, fRegistryModelInput); @@ -97,6 +101,7 @@ public class DynamicRegisteredModelInvocationTest extends TestCase { assertEquals(3, fRegistryModelInput.getContents().size()); } + @Test public void testDynamicModelInputOverRegistered() throws Exception { ModelExtent input = fNonRegistryModelInput; TransformationExecutor executor = new TransformationExecutor(fTransfURI, fDynamicPackageRegistry); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/IncrementalUpdateExecutorTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/IncrementalUpdateExecutorTest.java index bb2a5881a..6d1662226 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/IncrementalUpdateExecutorTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/IncrementalUpdateExecutorTest.java @@ -13,6 +13,7 @@ package org.eclipse.m2m.tests.qvt.oml.callapi; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.eclipse.emf.common.notify.Notification; @@ -29,23 +30,40 @@ import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.m2m.internal.qvt.oml.evaluator.QVTEvaluationOptions; import org.eclipse.m2m.qvt.oml.util.Trace; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import junit.framework.TestCase; +@RunWith(Parameterized.class) public class IncrementalUpdateExecutorTest extends TransformationExecutorTest { - public IncrementalUpdateExecutorTest() { - super("bug463572", Arrays.asList("in.ecore"), Arrays.asList("expected.ecore")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + public IncrementalUpdateExecutorTest(String name, List<String> inModels, List<String> outModels) { + super(name, inModels, outModels); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + @Parameters(name="{0}") + public static Iterable<Object[]> data() { + return Collections.singletonList( + new Object[] { + "bug463572", Arrays.asList("in.ecore"), Arrays.asList("expected.ecore") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + ); } @Override - protected void setUp() { + @Before + public void setUp() { super.setUp(); executionContext.getSessionData().setValue(QVTEvaluationOptions.INCREMENTAL_UPDATE_TRACE, Trace.createEmptyTrace()); } @Override - protected void runTest() throws Throwable { + @Test + public void runTest() throws Throwable { // 1. pass - create output model and appropriate trace super.runTest(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationExtTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationExtTest.java index ac2ce5431..9de51a63b 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationExtTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationExtTest.java @@ -26,6 +26,8 @@ import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.ModelExtent; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -49,6 +51,7 @@ public class InvocationExtTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -93,7 +96,8 @@ public class InvocationExtTest extends TestCase { // check the input was not changed assertEquals(fInitialInputContents, fInput.getContents()); } - + + @Test public void testInvokeIn_InOut_Out1_Out2() throws Exception { BasicModelExtent output1 = new BasicModelExtent(); BasicModelExtent output2 = new BasicModelExtent(); @@ -107,7 +111,8 @@ public class InvocationExtTest extends TestCase { assertInOutObject(); } - + + @Test public void testInOut() throws Exception { URI uri = URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvt.oml/deployed/callapi/InplaceEcore.qvto", false); //$NON-NLS-1$ fExecutor = new TransformationExecutor(uri); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationTest.java index 9c9af15fa..8889299ac 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/InvocationTest.java @@ -37,6 +37,8 @@ import org.eclipse.m2m.qvt.oml.TransformationExecutor; import org.eclipse.m2m.qvt.oml.util.Log; import org.eclipse.m2m.qvt.oml.util.StringBufferLog; import org.eclipse.m2m.tests.qvt.oml.AllTests; +import org.junit.Before; +import org.junit.Test; import org.osgi.framework.Bundle; import junit.framework.TestCase; @@ -58,6 +60,7 @@ public class InvocationTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -91,6 +94,7 @@ public class InvocationTest extends TestCase { assertEquals(fInitialInputContents, fInput.getContents()); } + @Test public void testAssertFailed() throws Exception { fContext.setConfigProperty("assertFail", Boolean.TRUE); //$NON-NLS-1$ ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); @@ -101,6 +105,7 @@ public class InvocationTest extends TestCase { assertTrue(fOutput.getContents().isEmpty()); } + @Test public void testStackTrace() throws Exception { // provoke an exception fContext.setConfigProperty("assertFail", Boolean.TRUE); //$NON-NLS-1$ @@ -119,7 +124,8 @@ public class InvocationTest extends TestCase { assertEquals(expected.toString(), strWr.toString()); } - + + @Test public void testMutlipleOutObjects() throws Exception { fContext.setConfigProperty("createTwoObjects", true); ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); @@ -128,6 +134,7 @@ public class InvocationTest extends TestCase { assertEquals(2, fOutput.getContents().size()); } + @Test public void testInvokeSuccess() throws Exception { final ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); assertEquals(Diagnostic.OK, diagnostic.getSeverity()); @@ -146,6 +153,7 @@ public class InvocationTest extends TestCase { assertEquals(Diagnostic.OK, nextDiagnostic.getSeverity()); } + @Test public void testLogging() throws Exception { StringBufferLog log = new StringBufferLog(); fContext.setLog(log); @@ -154,7 +162,8 @@ public class InvocationTest extends TestCase { assertEquals(Diagnostic.OK, diagnostic.getSeverity()); assertTrue(log.getContents().contains("Hello")); //$NON-NLS-1$ } - + + @Test public void testInterruption() throws Exception { final IProgressMonitor monitor = new NullProgressMonitor(); @@ -184,7 +193,8 @@ public class InvocationTest extends TestCase { assertEquals(ExecutionDiagnostic.USER_INTERRUPTED, diagnostic.getCode()); assertEquals(1, diagnostic.getStackTrace().size()); } - + + @Test public void testTransformationLoadFailure() throws Exception { URI uri = URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvt.oml/deployed/callapi/NotExisting.qvto", false); //$NON-NLS-1$ fExecutor = new TransformationExecutor(uri); @@ -196,6 +206,7 @@ public class InvocationTest extends TestCase { assertTrue(fOutput.getContents().isEmpty()); } + @Test public void testCompilationErrors() throws Exception { URI uri = URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvt.oml/deployed/callapi/CompilationErrors.qvto", false); //$NON-NLS-1$ fExecutor = new TransformationExecutor(uri); @@ -210,6 +221,7 @@ public class InvocationTest extends TestCase { assertTrue(fOutput.getContents().isEmpty()); } + @Test public void testNonExecutable() throws Exception { URI uri = URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvt.oml/deployed/callapi/NonExecutable.qvto", false); //$NON-NLS-1$ fExecutor = new TransformationExecutor(uri); @@ -221,19 +233,22 @@ public class InvocationTest extends TestCase { assertUnchangedInput(); assertTrue(fOutput.getContents().isEmpty()); } - + + @Test public void testLessModelParams() throws Exception { ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput); assertEquals(Diagnostic.ERROR, diagnostic.getSeverity()); assertEquals(ExecutionDiagnostic.MODEL_PARAMETER_MISMATCH, diagnostic.getCode()); } - + + @Test public void testModelModelParams() throws Exception { ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput, new BasicModelExtent()); assertEquals(Diagnostic.OK, diagnostic.getSeverity()); assertEquals(0, diagnostic.getCode()); } + @Test public void testNullModelParams() throws Exception { try { fExecutor.execute(fContext, (ModelExtent) null); @@ -244,6 +259,7 @@ public class InvocationTest extends TestCase { fail("Must have thrown exception"); //$NON-NLS-1$ } + @Test public void testNullOneOfModelParams() throws Exception { try { fExecutor.execute(fContext, new ModelExtent[] { fInput, null }); @@ -254,6 +270,7 @@ public class InvocationTest extends TestCase { fail("Must have thrown exception"); //$NON-NLS-1$ } + @Test public void testNullContext() throws Exception { try { fExecutor.execute(null, fInput, fOutput); @@ -264,6 +281,7 @@ public class InvocationTest extends TestCase { fail("Must have thrown exception"); //$NON-NLS-1$ } + @Test public void testInvokeOnGenericURIs() throws Exception { Bundle testBundle = Platform.getBundle(AllTests.BUNDLE_ID); File bundleFile = FileLocator.getBundleFile(testBundle); @@ -276,7 +294,8 @@ public class InvocationTest extends TestCase { assertEquals(Diagnostic.OK, diagnostic.getSeverity()); assertEquals(0, diagnostic.getCode()); } - + + @Test public void testConfigProperties() throws Exception { URI uri = URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvt.oml/parserTestData/models/bug267917/bug267917.qvto", false); //$NON-NLS-1$ fExecutor = new TransformationExecutor(uri); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/SourceContainerTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/SourceContainerTests.java index 0f7c069c9..a2b0ffa4c 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/SourceContainerTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/SourceContainerTests.java @@ -11,56 +11,51 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.callapi; +import java.util.Arrays; + import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; -import junit.framework.Test; import junit.framework.TestCase; -import junit.framework.TestSuite; /** * @author sboyko */ -public class SourceContainerTests { - - public static Test suite() { - TestSuite suite = new TestSuite("Source container in deployed plugins"); //$NON-NLS-1$ - - suite.addTest(new DeployedPluginText("TransformationProjectRelPath", - URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvto.transformationProject/root/RootTransformation.qvto", true))); +@RunWith(Parameterized.class) +public class SourceContainerTests extends TestCase { - suite.addTest(new DeployedPluginText("TransformationProjectFullPath", - URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvto.transformationProject/transforms/root/RootTransformation.qvto", true))); - - suite.addTest(new DeployedPluginText("PlainProject", - URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvto.pluginProject/transforms/root/RootTransformation.qvto", true))); - - // test transformation deployed with 'org.eclipse.m2m.tests.qvto.deployedTransfProject' plug-in - suite.addTest(new DeployedPluginText("DeployedTransfProject", - URI.createURI("deployedTransformationId", true))); - - return suite; + private final URI myUri; + + public SourceContainerTests(String name, URI uri) { + super(name); + myUri = uri; } - - - private static class DeployedPluginText extends TestCase { - private final URI myUri; - - DeployedPluginText(String name, URI uri) { - super(name); - myUri = uri; - } - - @Override - protected void runTest() throws Throwable { - TransformationExecutor executor = new TransformationExecutor(myUri); - ExecutionDiagnostic diagnostic = executor.execute(new ExecutionContextImpl()); - - assertEquals(Diagnostic.OK, diagnostic.getSeverity()); - } - + + @Parameters(name="{0}") + public static Iterable<Object[]> data() { + return Arrays.asList( + new Object[] {"TransformationProjectRelPath", URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvto.transformationProject/root/RootTransformation.qvto", true)}, + new Object[] {"TransformationProjectFullPath", URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvto.transformationProject/transforms/root/RootTransformation.qvto", true)}, + new Object[] {"PlainProject", URI.createPlatformPluginURI("org.eclipse.m2m.tests.qvto.pluginProject/transforms/root/RootTransformation.qvto", true)}, + + // test transformation deployed with 'org.eclipse.m2m.tests.qvto.deployedTransfProject' plug-in + new Object[] {"DeployedTransfProject", URI.createURI("deployedTransformationId", true)} + ); + } + + @Override + @Test + public void runTest() throws Throwable { + TransformationExecutor executor = new TransformationExecutor(myUri); + ExecutionDiagnostic diagnostic = executor.execute(new ExecutionContextImpl()); + + assertEquals(Diagnostic.OK, diagnostic.getSeverity()); } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtExecutor.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtExecutor.java index f1b3dec62..8dd0d692f 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtExecutor.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtExecutor.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.callapi; +import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -22,15 +23,26 @@ import org.eclipse.m2m.internal.qvt.oml.expressions.DirectionKind; import org.eclipse.m2m.qvt.oml.ModelExtent; import org.eclipse.m2m.tests.qvt.oml.transform.FilesToFilesData; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.TransformTests; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestQvtExecutor extends TransformationExecutorTest { private final List<URI> ecoreMetamodels; - + public TestQvtExecutor(ModelTestData data) { super(data.getName(), getInModels(data), getOutModels(data), data.getContext().getConfigProperties()); ecoreMetamodels = data.getEcoreMetamodels(); } + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.asList(TransformTests.createTestData()); + } static List<String> getInModels(ModelTestData data) { if (data instanceof FilesToFilesData) { @@ -50,14 +62,10 @@ public class TestQvtExecutor extends TransformationExecutorTest { protected List<URI> getEcoreMetamodels() { return ecoreMetamodels; } - - @Override - protected void setUp() { - super.setUp(); - } @Override - protected void runTest() throws Throwable { + @Test + public void runTest() throws Throwable { super.runTest(); ResourceSet checkingRs = CompilerUtils.cloneResourceSet(uriCreator.getTransformationUri(), resSet); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtStandaloneExecutor.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtStandaloneExecutor.java index 19f58945b..b9c4b75ce 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtStandaloneExecutor.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TestQvtStandaloneExecutor.java @@ -12,6 +12,7 @@ package org.eclipse.m2m.tests.qvt.oml.callapi; import java.io.File; +import java.util.Arrays; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EPackage; @@ -21,7 +22,13 @@ import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; import org.eclipse.m2m.internal.qvt.oml.common.MDAConstants; import org.eclipse.m2m.qvt.oml.TransformationExecutor; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.TransformTests; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestQvtStandaloneExecutor extends TestQvtExecutor { private ModelTestData data; @@ -32,8 +39,14 @@ public class TestQvtStandaloneExecutor extends TestQvtExecutor { uriCreator = new FileUriCreator(data.getName()); } + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.asList(TransformTests.createTestData()); + } + @Override - protected void setUp() { + @Before + public void setUp() { data.prepare(TransformationExecutor.BlackboxRegistry.INSTANCE); super.setUp(); } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorTest.java index ddc749f34..8eabdba64 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorTest.java @@ -45,11 +45,14 @@ import org.eclipse.m2m.qvt.oml.TransformationExecutor; import org.eclipse.m2m.qvt.oml.util.Trace; import org.eclipse.m2m.tests.qvt.oml.transform.FileToFileData; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; -public class TransformationExecutorTest extends TestCase { +public abstract class TransformationExecutorTest extends TestCase { final String name; final List<String> inModels; @@ -111,7 +114,8 @@ public class TransformationExecutorTest extends TestCase { } @Override - protected void setUp() { + @Before + public void setUp() { resSet = getMetamodelResolutionRS(); paramKinds = getParamKinds(); extents = new ArrayList<BasicModelExtent>(paramKinds.size()); @@ -143,7 +147,8 @@ public class TransformationExecutorTest extends TestCase { } @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { executor.cleanup(); BlackboxRegistry.INSTANCE.cleanup(); } @@ -152,7 +157,8 @@ public class TransformationExecutorTest extends TestCase { * Test if blackbox transformations can be successfully executed when running via TransformationExecutor. */ @Override - protected void runTest() throws Throwable { + @Test + public void runTest() throws Throwable { ExecutionDiagnostic diagnostic = executor.execute(executionContext, extents.toArray(new ModelExtent[extents.size()])); if (Diagnostic.OK != diagnostic.getSeverity() || 0 != diagnostic.getCode() diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorWithVisitorDecoratorTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorWithVisitorDecoratorTest.java index 88198314b..a768393f8 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorWithVisitorDecoratorTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/callapi/TransformationExecutorWithVisitorDecoratorTest.java @@ -14,13 +14,20 @@ package org.eclipse.m2m.tests.qvt.oml.callapi; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.List; import org.eclipse.m2m.internal.qvt.oml.evaluator.InternalEvaluator; import org.eclipse.m2m.internal.qvt.oml.evaluator.QVTEvaluationOptions; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtGenericVisitorDecorator; import org.eclipse.m2m.internal.qvt.oml.expressions.Helper; import org.eclipse.m2m.internal.qvt.oml.expressions.Module; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TransformationExecutorWithVisitorDecoratorTest extends TransformationExecutorTest { static String testBuffer = ""; //$NON-NLS-1$ @@ -44,17 +51,27 @@ public class TransformationExecutorWithVisitorDecoratorTest extends Transformati } - public TransformationExecutorWithVisitorDecoratorTest() { - super("bug416584", Arrays.asList("in.ecore"), Collections.<String>emptyList(), //$NON-NLS-1$ //$NON-NLS-2$ + public TransformationExecutorWithVisitorDecoratorTest(String name, List<String> inModels, List<String> outModels, String[][] configProps) { + super(name, inModels, outModels, configProps); + } + + @Parameters(name="{0}") + public static Iterable<Object[]> data() { + return Collections.singletonList( + new Object[] { + "bug416584", Arrays.asList("in.ecore"), Collections.<String>emptyList(), //$NON-NLS-1$ //$NON-NLS-2$ new String[][] { new String[] { "libProp", "123" }, //$NON-NLS-1$ //$NON-NLS-2$ new String[] { "prop", "prop" }, //$NON-NLS-1$ //$NON-NLS-2$ new String[] { "prop2", "prop2" }, //$NON-NLS-1$ //$NON-NLS-2$ - }); + } + } + ); } @Override - protected void setUp() { + @Before + public void setUp() { super.setUp(); testBuffer = ""; //$NON-NLS-1$ @@ -65,7 +82,8 @@ public class TransformationExecutorWithVisitorDecoratorTest extends Transformati } @Override - protected void runTest() throws Throwable { + @Test + public void runTest() throws Throwable { super.runTest(); assertEquals(testBuffer, "T2 lib_helper lib_helper T3_helper T3_helper lib_helper "); //$NON-NLS-1$ } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/AllCompileTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/AllCompileTests.java index 143892653..1489db6af 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/AllCompileTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/AllCompileTests.java @@ -11,20 +11,12 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.compile; -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; +@RunWith(Suite.class) +@SuiteClasses({PlatformPluginUnitResolverTest.class, UnitResolverFactoryTest.class, QVTOCompilerTest.class, URIUnitResolverTest.class}) public class AllCompileTests { - - public static Test suite() { - TestSuite suite = new TestSuite( - "Tests for org.eclipse.m2m.tests.qvt.oml.compile"); - //$JUnit-BEGIN$ - suite.addTestSuite(PlatformPluginUnitResolverTest.class); - suite.addTestSuite(UnitResolverFactoryTest.class); - suite.addTestSuite(QVTOCompilerTest.class); - //$JUnit-END$ - return suite; - } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/PlatformPluginUnitResolverTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/PlatformPluginUnitResolverTest.java index b42556c56..930d6a164 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/PlatformPluginUnitResolverTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/PlatformPluginUnitResolverTest.java @@ -22,6 +22,8 @@ import org.eclipse.m2m.internal.qvt.oml.compiler.UnitProxy; import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory; import org.eclipse.m2m.internal.qvt.oml.runtime.project.PlatformPluginUnitResolver; import org.eclipse.m2m.tests.qvt.oml.AllTests; +import org.junit.Before; +import org.junit.Test; import org.osgi.framework.Bundle; import junit.framework.TestCase; @@ -38,13 +40,15 @@ public class PlatformPluginUnitResolverTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); fBundle = Platform.getBundle(AllTests.BUNDLE_ID); assertNotNull(fBundle); } - + + @Test public void testInRootUnitResolver() throws Exception { PlatformPluginUnitResolver resolver = new PlatformPluginUnitResolver(fBundle); UnitProxy unit = resolver.resolveUnit("deployed.org.eclipse.Foo"); @@ -57,6 +61,7 @@ public class PlatformPluginUnitResolverTest extends TestCase { assertNotNull(unit); } + @Test public void testInContainerUnitResolver() throws Exception { PlatformPluginUnitResolver resolver = new PlatformPluginUnitResolver(fBundle, new Path("deployed")); UnitProxy unit = resolver.resolveUnit("org.eclipse.Foo"); @@ -69,12 +74,14 @@ public class PlatformPluginUnitResolverTest extends TestCase { assertNotNull(unit); } + @Test public void testUnresolvedUnit() throws Exception { PlatformPluginUnitResolver resolver = new PlatformPluginUnitResolver(fBundle, new Path("deployed")); UnitProxy unit = resolver.resolveUnit("org.eclipse.Foo_xxxxxxx"); assertNull(unit); } + @Test public void testDefaultNSUnitResolver() throws Exception { PlatformPluginUnitResolver resolver = new PlatformPluginUnitResolver(fBundle, new Path("deployed/org/eclipse")); UnitProxy unit = resolver.resolveUnit("Foo"); //$NON-NLS-1$ @@ -87,6 +94,7 @@ public class PlatformPluginUnitResolverTest extends TestCase { assertNotNull(unit); } + @Test public void testCrossNSUnitResolver() throws Exception { PlatformPluginUnitResolver resolver = new PlatformPluginUnitResolver(fBundle, new Path("/deployed")); PlatformPluginUnitResolver.setupResolver(resolver, true, true); @@ -101,6 +109,7 @@ public class PlatformPluginUnitResolverTest extends TestCase { assertNotNull(unit); } + @Test public void testUnitAccessByURI() throws Exception { URI uri = URI.createPlatformPluginURI("/org.eclipse.m2m.tests.qvt.oml/deployed/a/T1.qvto", false); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/QVTOCompilerTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/QVTOCompilerTest.java index 00476fa34..967c0c2e3 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/QVTOCompilerTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/QVTOCompilerTest.java @@ -24,6 +24,8 @@ import org.eclipse.m2m.internal.qvt.oml.compiler.URIUnitResolver; import org.eclipse.m2m.internal.qvt.oml.compiler.UnitContents; import org.eclipse.m2m.internal.qvt.oml.compiler.UnitProxy; import org.eclipse.m2m.tests.qvt.oml.AllTests; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -41,11 +43,13 @@ public class QVTOCompilerTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { URI baseURI = URI.createPlatformPluginURI(AllTests.BUNDLE_ID, true); fResolver = new URIUnitResolver(Collections.singletonList(baseURI)); } + @Test public void testCreateCompiler() throws Exception { UnitProxy fooUnit = fResolver.resolveUnit("deployed.org.eclipse.Foo"); assertNotNull(fooUnit); @@ -72,7 +76,8 @@ public class QVTOCompilerTest extends TestCase { compiler.cleanup(); } } - + + @Test public void testCreateCompilerWithHistory() throws Exception { UnitProxy fooUnit = fResolver.resolveUnit("deployed.org.eclipse.Foo"); assertNotNull(fooUnit); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/URIUnitResolverTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/URIUnitResolverTest.java index 0adf75709..1c24df4f3 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/URIUnitResolverTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/URIUnitResolverTest.java @@ -23,6 +23,7 @@ import org.eclipse.m2m.internal.qvt.oml.compiler.UnitContents; import org.eclipse.m2m.internal.qvt.oml.compiler.UnitProxy; import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory; import org.eclipse.m2m.tests.qvt.oml.AllTests; +import org.junit.Test; import org.osgi.framework.Bundle; import junit.framework.TestCase; @@ -40,6 +41,7 @@ public class URIUnitResolverTest extends TestCase { super(name); } + @Test public void testBaseAndNamespace() throws Exception { URI baseURI = URI.createPlatformPluginURI(AllTests.BUNDLE_ID, true); @@ -54,6 +56,7 @@ public class URIUnitResolverTest extends TestCase { unit.getURI()); } + @Test public void testNamespace() throws Exception { URI baseURI = URI.createPlatformPluginURI(AllTests.BUNDLE_ID + "/deployed", true); @@ -66,7 +69,8 @@ public class URIUnitResolverTest extends TestCase { unit.getURI()); assertContents(unit); } - + + @Test public void testDefaultNamespace() throws Exception { URI baseURI = URI.createPlatformPluginURI(AllTests.BUNDLE_ID + "/deployed/org/eclipse", true); @@ -80,6 +84,7 @@ public class URIUnitResolverTest extends TestCase { assertContents(unit); } + @Test public void testTrailPathSepBaseAndNamespace() throws Exception { URI baseURI = URI.createURI(URI.createPlatformPluginURI(AllTests.BUNDLE_ID, true).toString() + "/"); @@ -94,6 +99,7 @@ public class URIUnitResolverTest extends TestCase { } + @Test public void testUnresolvedByURI() throws Exception { URI baseURI = URI.createURI(URI.createPlatformPluginURI(AllTests.BUNDLE_ID, true).toString()); URIUnitResolver resolver = new URIUnitResolver(Collections.singletonList(baseURI)); @@ -103,6 +109,7 @@ public class URIUnitResolverTest extends TestCase { assertNull(UnitResolverFactory.Registry.INSTANCE.getUnit(URI.createURI(notExisting))); } + @Test public void testFileURI() throws Exception { Bundle testBundle = Platform.getBundle(AllTests.BUNDLE_ID); File bundleFile = FileLocator.getBundleFile(testBundle); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/UnitResolverFactoryTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/UnitResolverFactoryTest.java index a93c18106..58d443706 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/UnitResolverFactoryTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/compile/UnitResolverFactoryTest.java @@ -27,6 +27,9 @@ import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory; import org.eclipse.m2m.internal.qvt.oml.project.QVTOProjectPlugin; import org.eclipse.m2m.tests.qvt.oml.TestProject; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -39,6 +42,7 @@ public class UnitResolverFactoryTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { String srcFolder = "deployed"; //$NON-NLS-1$ myProject = TestProject.getExistingProject(srcFolder); @@ -50,6 +54,7 @@ public class UnitResolverFactoryTest extends TestCase { } @Override + @After protected void tearDown() throws Exception { File destinationFolder = getDestinationFolder(); if (destinationFolder.exists()) { @@ -57,6 +62,7 @@ public class UnitResolverFactoryTest extends TestCase { } } + @Test public void testAccessByWSPath() throws Exception { String unitPath = myProject.getProject().getFullPath().append(new Path("/transformations/a/T1.qvto")).toString(); URI uri = URI.createURI(unitPath, false); @@ -69,7 +75,8 @@ public class UnitResolverFactoryTest extends TestCase { unit.getURI()); assertNotNull(unit); } - + + @Test public void testAccessByPlatformResourceURI() throws Exception { String unitPath = myProject.getProject().getFullPath().append(new Path("/transformations/a/T1.qvto")).toString(); URI uri = URI.createPlatformResourceURI(unitPath, false); @@ -83,6 +90,7 @@ public class UnitResolverFactoryTest extends TestCase { assertNotNull(unit); } + @Test public void testAccessByPlatformPluginURI() throws Exception { URI uri = URI.createPlatformPluginURI("/org.eclipse.m2m.tests.qvt.oml/deployed/a/T1.qvto", false); UnitProxy unit = UnitResolverFactory.Registry.INSTANCE.getUnit(uri); @@ -94,13 +102,15 @@ public class UnitResolverFactoryTest extends TestCase { assertEquals(uri, unit.getURI()); assertNotNull(unit); } - + + @Test public void testAccessByDeployedIDURI() throws Exception { URI uri = URI.createURI("apiTestData.exec3_withImport.exec3_withImport", false); //$NON-NLS-1$ UnitProxy unit = UnitResolverFactory.Registry.INSTANCE.getUnit(uri); assertResolvedCompiledUnit(unit, true); } + @Test public void testAccessToUnresolvedURI() throws Exception { URI uri = URI.createPlatformPluginURI("/org.eclipse.m2m.tests.qvt.oml/deployed/a/T1_NeverFindMe.qvto", false); UnitProxy unit = UnitResolverFactory.Registry.INSTANCE.getUnit(uri); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/AllEmfTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/AllEmfTests.java deleted file mode 100644 index 56eeb6df3..000000000 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/AllEmfTests.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Borland Software Corporation 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: - * Borland Software Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.m2m.tests.qvt.oml.emf; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllEmfTests { - - public static Test suite() { - TestSuite suite = new TestSuite("Test for org.eclipse.m2m.tests.qvt.oml.emf"); //$NON-NLS-1$ - //$JUnit-BEGIN$ - suite.addTestSuite(TestEmfUtil.class); - //$JUnit-END$ - return suite; - } - -} diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/TestEmfUtil.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/TestEmfUtil.java index 33e2a6e49..60db697d0 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/TestEmfUtil.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/emf/TestEmfUtil.java @@ -15,6 +15,8 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.m2m.internal.qvt.oml.emf.util.EmfUtil; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -32,6 +34,7 @@ public class TestEmfUtil extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -43,13 +46,15 @@ public class TestEmfUtil extends TestCase { typeC1InPackage12 = createEClass(package12, "C12"); //$NON-NLS-1$ typeC1InPackage1 = createEClass(package1, "C1"); //$NON-NLS-1$ } - + + @Test public void testPackageQualifiedName() throws Exception { assertEquals("p1::p2::p3", EmfUtil.getFullName(package123)); //$NON-NLS-1$ assertEquals("p1::p2", EmfUtil.getFullName(package12)); //$NON-NLS-1$ assertEquals("p1", EmfUtil.getFullName(package1)); //$NON-NLS-1$ } - + + @Test public void testPackageRelativeQualifiedName() throws Exception { assertEquals("p2::p3", EmfUtil.getFullNameRelativeToPackage(package123, package1)); //$NON-NLS-1$ assertEquals("p3", EmfUtil.getFullNameRelativeToPackage(package123, package12)); //$NON-NLS-1$ @@ -57,6 +62,7 @@ public class TestEmfUtil extends TestCase { assertEquals("p1", EmfUtil.getFullNameRelativeToPackage(package1, package1)); //$NON-NLS-1$ } + @Test public void testPackageRelativeQualifiedTypeName() throws Exception { assertEquals("p1::p2::p3::C123", EmfUtil.getFullName(typeC1InPackage123)); //$NON-NLS-1$ @@ -67,6 +73,7 @@ public class TestEmfUtil extends TestCase { assertEquals("C12", EmfUtil.getFullNameRelativeToPackage(typeC1InPackage12, package12)); //$NON-NLS-1$ } + @Test public void testTypeQualifiedName() throws Exception { assertEquals("p1::p2::p3::C123", EmfUtil.getFullName(typeC1InPackage123)); //$NON-NLS-1$ assertEquals("p1::p2::C12", EmfUtil.getFullName(typeC1InPackage12)); //$NON-NLS-1$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/env/QVTOperationalEnvTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/env/QVTOperationalEnvTest.java index 78850d91e..4135f473b 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/env/QVTOperationalEnvTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/env/QVTOperationalEnvTest.java @@ -36,6 +36,8 @@ import org.eclipse.ocl.EvaluationVisitor; import org.eclipse.ocl.ecore.CallOperationAction; import org.eclipse.ocl.ecore.Constraint; import org.eclipse.ocl.ecore.SendSignalAction; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -48,12 +50,14 @@ public class QVTOperationalEnvTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); factory = QvtOperationalEnvFactory.INSTANCE; } + @Test public void testImportedEnvironments() throws Exception { QvtOperationalModuleEnv parentEnv = factory.createModuleEnvironment(QvtOperationalStdLibrary.createLibrary("Foo")); QvtOperationalModuleEnv importedEnv = factory.createModuleEnvironment(QvtOperationalStdLibrary.createLibrary("Imported")); @@ -82,7 +86,8 @@ public class QVTOperationalEnvTest extends TestCase { super(qvtExtVisitor); } } - + + @Test public void testVisitorDecorators() throws Exception { // Specify a decorator class to be used List<Class<? extends QvtGenericVisitorDecorator>> decorators = new ArrayList<Class<? extends QvtGenericVisitorDecorator>>(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/ExtOCLEnvironmentWithQVTAccessTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/ExtOCLEnvironmentWithQVTAccessTest.java index 39aa1abb7..0f5a7f935 100755 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/ExtOCLEnvironmentWithQVTAccessTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/ExtOCLEnvironmentWithQVTAccessTest.java @@ -31,6 +31,7 @@ import org.eclipse.ocl.ecore.Constraint; import org.eclipse.ocl.ecore.EcoreEvaluationEnvironment; import org.eclipse.ocl.ecore.OCL.Query; import org.eclipse.ocl.helper.OCLHelper; +import org.junit.Test; public class ExtOCLEnvironmentWithQVTAccessTest extends OCLEnvironmentWithQVTAccessTest { @@ -62,6 +63,7 @@ public class ExtOCLEnvironmentWithQVTAccessTest extends OCLEnvironmentWithQVTAcc return evaluate(evalEnv, query); } + @Test public void testcallQueryThrowingException() throws Exception { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); try { diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTAccessDiagnosticTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTAccessDiagnosticTest.java index a84212812..1b083bc44 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTAccessDiagnosticTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTAccessDiagnosticTest.java @@ -17,6 +17,7 @@ import java.util.List; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; import org.eclipse.m2m.internal.qvt.oml.runtime.util.OCLEnvironmentWithQVTAccessFactory; +import org.junit.Test; import junit.framework.TestCase; @@ -26,6 +27,7 @@ public class OCLEnvWithQVTAccessDiagnosticTest extends TestCase { super(); } + @Test public void testCSTAndBlackboxSuccess() throws Exception { Diagnostic diagnostic = createFactoryDiagnostic( "qvto://blackbox/org.eclipse.m2m.tests.qvt.oml.bbox.SimpleJavaLibrary", @@ -34,6 +36,7 @@ public class OCLEnvWithQVTAccessDiagnosticTest extends TestCase { assertTrue(diagnostic.getSeverity() == Diagnostic.OK); } + @Test public void testCompilationErrors() throws Exception { String uri = "platform:/plugin/org.eclipse.m2m.tests.qvt.oml/parserTestData/externlib/errorsLib.qvto"; Diagnostic diagnostic = createFactoryDiagnostic(uri); @@ -42,7 +45,8 @@ public class OCLEnvWithQVTAccessDiagnosticTest extends TestCase { assertFalse(children.isEmpty()); assertEquals(uri, children.get(0).getSource()); } - + + @Test public void testUnresolved() throws Exception { String badURI = "platform:/plugin/never.exist"; String okURI = "qvto://blackbox/org.eclipse.m2m.tests.qvt.oml.bbox.SimpleJavaLibrary"; diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTTests.java index 2414aeac8..03ff41684 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvWithQVTTests.java @@ -11,22 +11,18 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.ocl2qvt; -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; +@RunWith(Suite.class) +@SuiteClasses({ + ExtOCLEnvironmentWithQVTAccessTest.class, + OCLEnvironmentWithQVTAccessTest.class, + OCLEnvironmentWithQVTAccessByURITest.class, + OCLEnvironmentWithQVTAccessByURITest.DynamicPackageTest.class, + OCLEnvWithQVTAccessDiagnosticTest.class, +}) public class OCLEnvWithQVTTests { - public static Test suite() { - TestSuite suite = new TestSuite("Test for OCL environments with QVT access"); //$NON-NLS-1$ - - //$JUnit-BEGIN$ - suite.addTestSuite(ExtOCLEnvironmentWithQVTAccessTest.class); - suite.addTestSuite(OCLEnvironmentWithQVTAccessTest.class); - suite.addTestSuite(OCLEnvironmentWithQVTAccessByURITest.class); - suite.addTestSuite(OCLEnvironmentWithQVTAccessByURITest.DynamicPackageTest.class); - suite.addTestSuite(OCLEnvWithQVTAccessDiagnosticTest.class); - //$JUnit-END$ - return suite; - } - } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessByURITest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessByURITest.java index 90818609f..b90310529 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessByURITest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessByURITest.java @@ -23,6 +23,8 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.m2m.internal.qvt.oml.expressions.ModelType; import org.eclipse.m2m.internal.qvt.oml.expressions.Module; import org.eclipse.m2m.internal.qvt.oml.runtime.util.OCLEnvironmentWithQVTAccessFactory; +import org.junit.Before; +import org.junit.Test; public class OCLEnvironmentWithQVTAccessByURITest extends OCLEnvironmentWithQVTAccessTest { @@ -35,6 +37,7 @@ public class OCLEnvironmentWithQVTAccessByURITest extends OCLEnvironmentWithQVTA } @Override + @Before protected void setUp() { super.setUp(); assertNotNull(fMetamodeModel); @@ -51,6 +54,7 @@ public class OCLEnvironmentWithQVTAccessByURITest extends OCLEnvironmentWithQVTA assertTrue(usesOurPackageInstance); } + @Test public void testImportedContextualOperation() throws org.eclipse.ocl.ParserException { // make this pass as it imported from a black-box library // in which case it's forced to reference the Java generated metamodel package diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessTest.java index cabce779d..2ab815264 100755 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/ocl2qvt/OCLEnvironmentWithQVTAccessTest.java @@ -41,6 +41,9 @@ import org.eclipse.ocl.ecore.OCL; import org.eclipse.ocl.ecore.OCL.Query; import org.eclipse.ocl.ecore.Variable; import org.eclipse.ocl.helper.OCLHelper; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -76,6 +79,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } @Override + @Before protected void setUp() { fEnvFactory = createOCLEnvFactory(); assertTrue(fEnvFactory.getDiagnostic().getSeverity() == Diagnostic.OK); @@ -113,12 +117,14 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } @Override + @After protected void tearDown() throws Exception { this.fEnvFactory = null; this.fOCL = null; } @SuppressWarnings("unchecked") + @Test public void testUserDefinedVariables() throws Exception { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -149,7 +155,8 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { fail("Additional operation should come from super type"); //$NON-NLS-1$ } } - + + @Test public void testImportedOperationAccessingModuleProperty() throws Exception { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -168,7 +175,8 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { fail("Additional operation should come from super type"); //$NON-NLS-1$ } } - + + @Test public void testStdlibOperationAccess() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -192,7 +200,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } } - + @Test public void testQVTStdlibOperationAccess() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -216,7 +224,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } } - + @Test public void testImportedModulePropertyAccess() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -236,7 +244,8 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { fail("Additional operation should come from super type"); //$NON-NLS-1$ } } - + + @Test public void testImportedOperations() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -257,7 +266,8 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { fail(e.getLocalizedMessage()); } } - + + @Test public void testComplextTypeInSignatures() throws Exception { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -279,7 +289,8 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { fail(e.getLocalizedMessage()); } } - + + @Test public void testImportedContextualOperation() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -309,7 +320,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } } - + @Test public void testImportedOperationOnCollection() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -331,6 +342,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } } + @Test public void testCallImportedQvtFileWhichCallsJavaLibrary() throws ParserException { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); helper.setContext(EcorePackage.eINSTANCE.getENamedElement()); @@ -351,6 +363,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } } + @Test public void testValidationProblems() throws Exception { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); try { @@ -364,6 +377,7 @@ public class OCLEnvironmentWithQVTAccessTest extends TestCase { } } + @Test public void testParsingProblems() throws Exception { OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = fOCL.createOCLHelper(); try { diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/perf/ExecutionTimeGuardTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/perf/ExecutionTimeGuardTest.java index c33b64da8..d02f713b6 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/perf/ExecutionTimeGuardTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/perf/ExecutionTimeGuardTest.java @@ -17,6 +17,8 @@ import org.eclipse.m2m.qvt.oml.BasicModelExtent; import org.eclipse.m2m.qvt.oml.ExecutionContextImpl; import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic; import org.eclipse.m2m.qvt.oml.TransformationExecutor; +import org.junit.Before; +import org.junit.Test; import junit.framework.TestCase; @@ -32,6 +34,7 @@ public class ExecutionTimeGuardTest extends TestCase { } @Override + @Before protected void setUp() throws Exception { super.setUp(); @@ -41,6 +44,7 @@ public class ExecutionTimeGuardTest extends TestCase { } } + @Test public void testTraceLookup_287589() throws Exception { assertSuccessExecutionTime("traceLookup_287589.qvto", 5000); //$NON-NLS-1$ } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFile.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFile.java index aa3761bbc..2a34ec12d 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFile.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFile.java @@ -11,13 +11,20 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.traces; +import java.util.Arrays; + import org.eclipse.m2m.internal.qvt.oml.trace.Trace; import org.eclipse.m2m.tests.qvt.oml.transform.FileToFileData; import org.eclipse.m2m.tests.qvt.oml.transform.TestQvtInterpreter; import org.eclipse.m2m.tests.qvt.oml.transform.TestTransformation; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; - +@RunWith(Parameterized.class) public class TestTraceFile extends TestTransformation { private final int myExpectedTraceSize; @@ -26,12 +33,22 @@ public class TestTraceFile extends TestTransformation { myExpectedTraceSize = expectedTraceSize; } + @Parameters(name="{0}") + public static Iterable<Object[]> data() { + return Arrays.asList( + new Object[] {"multipletracerecords", 5}, //$NON-NLS-1$ + new Object[] {"mappingWithNoResultTrace_266854", 1} //$NON-NLS-1$ + ); + } + @Override + @Test public void runTest() throws Exception { check(TestQvtInterpreter.getDefaultTransformer(getData())); } @Override + @Before public void setUp() throws Exception { super.setUp(); buildTestProject(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFileForMyUml.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFileForMyUml.java index ffd1e83cd..59bc10a56 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFileForMyUml.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/traces/TestTraceFileForMyUml.java @@ -11,19 +11,35 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.traces; +import java.util.Arrays; + import org.eclipse.m2m.internal.qvt.oml.trace.Trace; +import org.eclipse.m2m.tests.qvt.oml.transform.FileToFileData; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; import org.eclipse.m2m.tests.qvt.oml.transform.TestQvtInterpreter; import org.eclipse.m2m.tests.qvt.oml.transform.TestTransformation; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; - +@RunWith(Parameterized.class) public class TestTraceFileForMyUml extends TestTransformation { public TestTraceFileForMyUml(ModelTestData data) { super(data); } - + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.<ModelTestData>asList( + new FileToFileData("multipletracerecords"), //$NON-NLS-1$ + new FileToFileData("mappingWithNoResultTrace_266854") //$NON-NLS-1$ + ); + } + + @Test public void testHasTraces() throws Exception { ITransformer transformer = TestQvtInterpreter.getDefaultTransformer(getData()); Trace trace = TraceUtil.transform(getData(), getProject(), transformer); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/AbstractStackTraceTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/AbstractStackTraceTest.java index 38596c87a..f29b53079 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/AbstractStackTraceTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/AbstractStackTraceTest.java @@ -31,6 +31,7 @@ import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtInterpretedTransforma import org.eclipse.m2m.qvt.oml.util.IContext; import org.eclipse.m2m.qvt.oml.util.WriterLog; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.Before; public abstract class AbstractStackTraceTest extends TestTransformation { @@ -43,6 +44,7 @@ public abstract class AbstractStackTraceTest extends TestTransformation { } @Override + @Before public void setUp() throws Exception { super.setUp(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/FilesToFilesData.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/FilesToFilesData.java index 58bf7f1d3..e3530b4b1 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/FilesToFilesData.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/FilesToFilesData.java @@ -41,7 +41,7 @@ public class FilesToFilesData extends ModelTestData { myFromFiles = fromFiles; myExpectedFiles = expectedFiles; } - + @Override public List<URI> getIn(IProject project) { List<URI> inUris = new ArrayList<URI>(myFromFiles.size()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ModelTestData.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ModelTestData.java index 5affa5d11..f1e9ec61f 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ModelTestData.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ModelTestData.java @@ -72,6 +72,11 @@ public abstract class ModelTestData { return myName; } + @Override + public String toString() { + return getName(); + } + public static void compareWithExpected(String name, List<EObject> expected, List<EObject> out) { TestCase.assertEquals("transf output differs in size to expected result", //$NON-NLS-1$ expected.size(), out.size()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ReferencedProjectData.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ReferencedProjectData.java index 442111f5a..214ff3bff 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ReferencedProjectData.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/ReferencedProjectData.java @@ -42,6 +42,11 @@ public class ReferencedProjectData extends FilesToFilesData { } @Override + public String toString() { + return getName() + " cycle: " + isUseCycleReferences; + } + + @Override public void prepare(TestProject project) throws Exception { referencedProjectTestCase.setUp(); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/StandaloneTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/StandaloneTests.java deleted file mode 100644 index 610ecd8e6..000000000 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/StandaloneTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Borland Software Corporation 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: - * Christopher Gerking - initial API and implementation - *******************************************************************************/ -package org.eclipse.m2m.tests.qvt.oml.transform; - -import org.eclipse.m2m.tests.qvt.oml.callapi.TestQvtStandaloneExecutor; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class StandaloneTests extends TestCase { - - public static Test suite() { - - TestSuite suite = new TestSuite("QVT standalone executor"); - //$JUnit-BEGIN$ - - ModelTestData[] datas = TransformTests.createTestData(); - - for (ModelTestData data : datas) { - suite.addTest(new TestQvtStandaloneExecutor(data)); - } - - //$JUnit-END$ - return suite; - } - -} diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestBlackboxLibContext.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestBlackboxLibContext.java index cbc0d31dd..9deaf3c76 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestBlackboxLibContext.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestBlackboxLibContext.java @@ -13,21 +13,35 @@ package org.eclipse.m2m.tests.qvt.oml.transform; import java.io.PrintWriter; import java.io.StringWriter; +import java.util.Collections; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtInterruptedExecutionException; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestBlackboxLibContext extends AbstractStackTraceTest { - public TestBlackboxLibContext() { - super(new FileToFileData("blackboxlib_context", //$NON-NLS-1$ + public TestBlackboxLibContext(ModelTestData data) { + super(data); + } + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Collections.<ModelTestData>singletonList( + new FileToFileData("blackboxlib_context", //$NON-NLS-1$ new String[][] { {"strTest", "test"}, //$NON-NLS-1$ //$NON-NLS-2$ {"strTest2", "test2"}, //$NON-NLS-1$ //$NON-NLS-2$ } - )); + ) + ); } + @Test public void testInvalidConfigProp() throws Exception { String testcase = "executionTerminated"; //$NON-NLS-1$ QvtRuntimeException e = runQvtModuleTestCase(testcase, getData().getContext().getConfigProperties()); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestFailedTransformation.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestFailedTransformation.java index aae7aefdc..a79396695 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestFailedTransformation.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestFailedTransformation.java @@ -13,27 +13,65 @@ package org.eclipse.m2m.tests.qvt.oml.transform; import java.io.File; import java.io.IOException; import java.io.StringWriter; +import java.util.Arrays; import org.eclipse.m2m.internal.qvt.oml.common.io.IOFile; +import org.eclipse.m2m.internal.qvt.oml.evaluator.QVTEvaluationOptions; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException; import org.eclipse.m2m.internal.qvt.oml.library.Context; import org.eclipse.m2m.internal.qvt.oml.runtime.util.MiscUtil; +import org.eclipse.m2m.qvt.oml.util.IContext; import org.eclipse.m2m.qvt.oml.util.WriterLog; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestFailedTransformation extends TestTransformation { public TestFailedTransformation(ModelTestData data) { super(data); setName(TestQvtInterpreter.PREFIX + data.getName()); } - + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.asList( + new ModelTestData[] { + new FileToFileData("scr878") { //$NON-NLS-1$ + @Override + public IContext getContext() { + IContext ctx = super.getContext(); + ctx.getSessionData().setValue(QVTEvaluationOptions.FLAG_READONLY_GUARD_ENABLED, Boolean.TRUE); + return ctx; + } + }, + new FilesToFilesData("bug301134"), //$NON-NLS-1$ + new FilesToFilesData("bug323915"), //$NON-NLS-1$ + new FilesToFilesData("bug370098") { //$NON-NLS-1$ + @Override + public IContext getContext() { + IContext ctx = super.getContext(); + ctx.getSessionData().setValue(QVTEvaluationOptions.EVALUATION_MAX_STACK_DEPTH, 10); + return ctx; + } + }, + new FilesToFilesData("bug289982_failed") //$NON-NLS-1$ + } + ); + } + @Override + @Before public void setUp() throws Exception { super.setUp(); buildTestProject(); } @Override + @Test public void runTest() throws Exception { runTransformation(); assertLogMatch("qvtTraceLog.stack"); //$NON-NLS-1$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestIncorrectTransformation.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestIncorrectTransformation.java index be0737a86..c2c557593 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestIncorrectTransformation.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestIncorrectTransformation.java @@ -11,14 +11,46 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform; +import java.util.Arrays; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + import junit.framework.AssertionFailedError; +@RunWith(Parameterized.class) public class TestIncorrectTransformation extends TestQvtInterpreter { public TestIncorrectTransformation(ModelTestData data) { super(data); } + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.asList( + new ModelTestData[] { + new ReferencedProjectData("bug433937_wrongImport", "bug433937_referenced", false) { //$NON-NLS-1$ //$NON-NLS-2$ + @Override + public boolean isUseCompiledXmi() { + // TODO it should be possible to run this test with the + // using of compiled XMI + return false; + } + }, + new ReferencedProjectData("bug433937_wrongImport", "bug433937_referenced", true) { //$NON-NLS-1$ //$NON-NLS-2$ + @Override + public boolean isUseCompiledXmi() { + // TODO it should be possible to run this test with the + // using of compiled XMI + return false; + } + } + } + ); + } + @Override protected void onBuildFailed(Throwable e) { if (e instanceof AssertionFailedError) { @@ -30,6 +62,7 @@ public class TestIncorrectTransformation extends TestQvtInterpreter { } @Override + @Test public void runTest() throws Exception { // skip test execution since it's failed to build } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestInvalidConfigProperty.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestInvalidConfigProperty.java index 86af56eb6..128bb035f 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestInvalidConfigProperty.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestInvalidConfigProperty.java @@ -13,17 +13,31 @@ package org.eclipse.m2m.tests.qvt.oml.transform; import java.io.PrintWriter; import java.io.StringWriter; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestInvalidConfigProperty extends AbstractStackTraceTest { - public TestInvalidConfigProperty() { - super(new FileToFileData("invalidConfigProp")); //$NON-NLS-1$ + public TestInvalidConfigProperty(ModelTestData data) { + super(data); } + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Collections.<ModelTestData>singletonList( + new FileToFileData("invalidConfigProp") //$NON-NLS-1$ + ); + } + + @Test public void testInvalidConfigProp() throws Exception { String testCase = "invalidConfigProp"; //$NON-NLS-1$ @@ -41,6 +55,7 @@ public class TestInvalidConfigProperty extends AbstractStackTraceTest { assertEqualContents(dumpedContents.toString(), strWriter.getBuffer().toString()); } + @Test public void testInvalidRealConfigProp() throws Exception { String testCase = "invalidConfigProp"; //$NON-NLS-1$ @@ -58,6 +73,7 @@ public class TestInvalidConfigProperty extends AbstractStackTraceTest { assertEqualContents(dumpedContents.toString(), strWriter.getBuffer().toString()); } + @Test public void testUndefinedConfigProp() throws Exception { String testCase = "invalidConfigProp"; //$NON-NLS-1$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtInterpreter.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtInterpreter.java index 5b8015739..73b0eb728 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtInterpreter.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtInterpreter.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform; +import java.util.Arrays; import java.util.List; import org.eclipse.core.resources.IFile; @@ -25,7 +26,13 @@ import org.eclipse.m2m.internal.qvt.oml.compiler.QvtCompilerOptions; import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtInterpretedTransformation; import org.eclipse.m2m.internal.qvt.oml.runtime.project.WorkspaceQvtModule; import org.eclipse.m2m.qvt.oml.util.IContext; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestQvtInterpreter extends TestTransformation { static final String PREFIX = "interpret_"; //$NON-NLS-1$ @@ -35,11 +42,17 @@ public class TestQvtInterpreter extends TestTransformation { setName(PREFIX + data.getName()); } + @Parameters(name="{0}") + public static Iterable<? extends ModelTestData> data() { + return Arrays.asList(TransformTests.createTestData()); + } + protected ITransformer getTransformer() { return new DefaultTransformer(getData(), getProject()); } @Override + @Before public void setUp() throws Exception { super.setUp(); @@ -57,6 +70,7 @@ public class TestQvtInterpreter extends TestTransformation { } @Override + @Test public void runTest() throws Exception { checkTransformation(new TransformationChecker(getTransformer())); } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtWalker.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtWalker.java index ab0c6ed6d..42b9fd971 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtWalker.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestQvtWalker.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform; +import java.util.Arrays; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.m2m.internal.qvt.oml.ast.parser.QvtOperationalAstWalker; @@ -22,7 +24,12 @@ import org.eclipse.m2m.internal.qvt.oml.emf.util.URIUtils; import org.eclipse.m2m.internal.qvt.oml.expressions.Module; import org.eclipse.m2m.internal.qvt.oml.project.QvtEngine; import org.eclipse.ocl.utilities.Visitable; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class TestQvtWalker extends TestTransformation { private static final String PREFIX = "walker_"; //$NON-NLS-1$ @@ -31,8 +38,14 @@ public class TestQvtWalker extends TestTransformation { super(data); setName(PREFIX + data.getName()); } - + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.asList(TransformTests.createTestData()); + } + @Override + @Test public void runTest() throws Exception { checkTransformation(new IChecker() { public void check(ModelTestData data, IProject project) throws Exception { diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestStackTrace.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestStackTrace.java index f4966e560..442743950 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestStackTrace.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestStackTrace.java @@ -18,6 +18,8 @@ import org.eclipse.m2m.internal.qvt.oml.evaluator.QVTStackTraceElement; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtAssertionFailed; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException; import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtStackOverFlowError; +import org.junit.Before; +import org.junit.Test; public class TestStackTrace extends AbstractStackTraceTest { @@ -26,6 +28,7 @@ public class TestStackTrace extends AbstractStackTraceTest { } @Override + @Before public void setUp() throws Exception { if("testUknownSourceStackTrace".equals(getName())) { //$NON-NLS-1$ // we need to compile concrete syntax which is instructed to skip line number info @@ -35,6 +38,7 @@ public class TestStackTrace extends AbstractStackTraceTest { super.setUp(); } + @Test public void testMappingCallInProperty() throws Exception { String testCase = "mappingCallInProperty"; //$NON-NLS-1$ QvtRuntimeException e = runQvtModuleTestCase(testCase); @@ -48,13 +52,14 @@ public class TestStackTrace extends AbstractStackTraceTest { assertEqualContents(dumpedContents.toString(), strWriter.getBuffer().toString()); } - + @Test public void testLogExpUsage() throws Exception { String testcase = "testLogExpUsage"; //$NON-NLS-1$ runQvtModuleTestCase(testcase); assertLogMatch(testcase); } + @Test public void testAssertionFailed() throws Exception { String testcase = "assertionFailed"; //$NON-NLS-1$ QvtRuntimeException e = runQvtModuleTestCase(testcase); @@ -70,6 +75,7 @@ public class TestStackTrace extends AbstractStackTraceTest { assertLogMatch(testcase); } + @Test public void testStackOverFlow() throws Exception { QvtRuntimeException e = runQvtModuleTestCase("stackOverFlow"); //$NON-NLS-1$ @@ -97,6 +103,7 @@ public class TestStackTrace extends AbstractStackTraceTest { /* * Just verifies a complete regular stack trace */ + @Test public void testCreateInstaceFailure() throws Exception { String testCase = "createInstaceFailure"; //$NON-NLS-1$ QvtRuntimeException e = runQvtModuleTestCase(testCase); @@ -109,7 +116,8 @@ public class TestStackTrace extends AbstractStackTraceTest { String dumpedContents = loadExpectedStackDump(testCase); assertEqualContents(dumpedContents.toString(), strWriter.getBuffer().toString()); } - + + @Test public void testUknownSourceStackTrace() throws Exception { String testCase = "createInstaceFailure"; //$NON-NLS-1$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestTransformation.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestTransformation.java index bfe4e58dd..b4d56f012 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestTransformation.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TestTransformation.java @@ -58,6 +58,8 @@ import org.eclipse.m2m.internal.qvt.oml.runtime.project.TransformationUtil; import org.eclipse.m2m.qvt.oml.util.IContext; import org.eclipse.m2m.tests.qvt.oml.TestProject; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; import junit.framework.TestCase; @@ -95,6 +97,7 @@ public abstract class TestTransformation extends TestCase { } @Override + @Before public void setUp() throws Exception { TestUtil.turnOffAutoBuilding(); @@ -177,6 +180,7 @@ public abstract class TestTransformation extends TestCase { } @Override + @After public void tearDown() throws Exception { if (myData == null) { return; diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TraceTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TraceTests.java deleted file mode 100644 index 229afaba2..000000000 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TraceTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Borland Software Corporation 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: - * Borland Software Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.m2m.tests.qvt.oml.transform; - -import org.eclipse.m2m.tests.qvt.oml.traces.TestTraceFile; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author aigdalov - * Created on Mar 3, 2009 - */ -public class TraceTests { - public static Test suite() { - TestSuite suite = new TestSuite("QVT traces"); //$NON-NLS-1$ - - suite.addTest(new TestTraceFile("multipletracerecords", 5)); //$NON-NLS-1$ - suite.addTest(new TestTraceFile("mappingWithNoResultTrace_266854", 1)); //$NON-NLS-1$ - - return suite; - } - -} diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformManyModelTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformManyModelTests.java index 20f10ec37..35d2e77c2 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformManyModelTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformManyModelTests.java @@ -14,40 +14,31 @@ package org.eclipse.m2m.tests.qvt.oml.transform; import java.util.Arrays; import java.util.Collections; -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ -public class TransformManyModelTests { - public static Test suite() { - return interpreterSuite(); - } +@RunWith(Parameterized.class) +public class TransformManyModelTests extends TestQvtInterpreter { - public static TestSuite interpreterSuite() { - TestSuite suite = new TestSuite("QVT interpreter (many files)"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - for (ModelTestData data : datas) { - suite.addTest(new TestQvtInterpreter(data)); - } - - return suite; - } - - public static ModelTestData[] createTestData() { - return new ModelTestData[] { - new FilesToFilesData("mm_modifyvar", Arrays.asList("in.ecore", "in2.ecore"), Arrays.asList("expected.ecore")), //$NON-NLS-1$ - new FilesToFilesData("mm_header1", Arrays.asList("in.ecore"), Arrays.asList("expected.simpleuml", "expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ - new FilesToFilesData("mm_header2", Arrays.asList("in.ecore"), Arrays.asList("expected.uml", "expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ - new FilesToFilesData("mm_header3", Arrays.asList("in.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ - new FilesToFilesData("mm_header4", Arrays.asList("in1.ecore", "in2.ecore", "in3.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ - new FilesToFilesData("entryOp", Arrays.asList("in1.ecore", "in2.ecore", "in3.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ - new FilesToFilesData("importedExtents", Collections.<String>emptyList(), Arrays.asList("expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ - }; - } - + public TransformManyModelTests(ModelTestData data) { + super(data); + } + + @Parameters(name="{0}") + public static Iterable<? extends ModelTestData> data() { + return Arrays.asList( + new FilesToFilesData("mm_modifyvar", Arrays.asList("in.ecore", "in2.ecore"), Arrays.asList("expected.ecore")), //$NON-NLS-1$ + new FilesToFilesData("mm_header1", Arrays.asList("in.ecore"), Arrays.asList("expected.simpleuml", "expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ + new FilesToFilesData("mm_header2", Arrays.asList("in.ecore"), Arrays.asList("expected.uml", "expected.ecore")), //$NON-NLS-1$ //$NON-NLS-2$ + new FilesToFilesData("mm_header3", Arrays.asList("in.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ + new FilesToFilesData("mm_header4", Arrays.asList("in1.ecore", "in2.ecore", "in3.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ + new FilesToFilesData("entryOp", Arrays.asList("in1.ecore", "in2.ecore", "in3.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ + new FilesToFilesData("importedExtents", Collections.<String>emptyList(), Arrays.asList("expected.ecore")) //$NON-NLS-1$ //$NON-NLS-2$ + ); + } } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformTests.java index 058514623..2b2510399 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/TransformTests.java @@ -19,30 +19,24 @@ package org.eclipse.m2m.tests.qvt.oml.transform; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.eclipse.emf.ecore.EPackage; -import org.eclipse.m2m.internal.qvt.oml.evaluator.QVTEvaluationOptions; import org.eclipse.m2m.internal.qvt.oml.expressions.ExpressionsPackage; import org.eclipse.m2m.qvt.oml.TransformationExecutor.BlackboxRegistry; import org.eclipse.m2m.qvt.oml.ocl.legacy.libraries.EmfToolsLibrary; import org.eclipse.m2m.qvt.oml.ocl.legacy.libraries.StringLibrary; -import org.eclipse.m2m.qvt.oml.util.IContext; import org.eclipse.m2m.tests.qvt.oml.TestBlackboxLibrary; import org.eclipse.m2m.tests.qvt.oml.bbox.AnnotatedJavaLibrary; import org.eclipse.m2m.tests.qvt.oml.bbox.Bug289982_Library; import org.eclipse.m2m.tests.qvt.oml.bbox.Bug427237_Library; import org.eclipse.m2m.tests.qvt.oml.bbox.SimpleJavaLibrary; -import org.eclipse.m2m.tests.qvt.oml.callapi.DebugExecutorTest; -import org.eclipse.m2m.tests.qvt.oml.callapi.TestQvtExecutor; -import org.eclipse.m2m.tests.qvt.oml.transform.javaless.JavalessQvtTest; -import org.eclipse.m2m.tests.qvt.oml.transform.javaless.JavalessUtil; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; import generics.GenericsPackage; -import junit.framework.Test; -import junit.framework.TestSuite; +import junit.framework.TestCase; import simpleuml.SimpleumlPackage; import testqvt.TestqvtPackage; @@ -50,118 +44,10 @@ import testqvt.TestqvtPackage; /** * @author pkobiakov */ -public class TransformTests { - public static Test suite() { - return interpreterSuite(); - } - - public static TestSuite interpreterSuite() { - TestSuite suite = new TestSuite("QVT interpreter"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - suite.addTest(new TestFailedTransformation(new FileToFileData("scr878") { //$NON-NLS-1$ - @Override - public IContext getContext() { - IContext ctx = super.getContext(); - ctx.getSessionData().setValue(QVTEvaluationOptions.FLAG_READONLY_GUARD_ENABLED, Boolean.TRUE); - return ctx; - } - })); - suite.addTest(new TestFailedTransformation(new FilesToFilesData("bug301134"))); //$NON-NLS-1$ - suite.addTest(new TestFailedTransformation(new FilesToFilesData("bug323915"))); //$NON-NLS-1$ - suite.addTest(new TestFailedTransformation(new FilesToFilesData("bug370098") { //$NON-NLS-1$ - @Override - public IContext getContext() { - IContext ctx = super.getContext(); - ctx.getSessionData().setValue(QVTEvaluationOptions.EVALUATION_MAX_STACK_DEPTH, 10); - return ctx; - } - })); - suite.addTest(new TestFailedTransformation(new FilesToFilesData("bug289982_failed"))); //$NON-NLS-1$ - - for (ModelTestData data : datas) { - suite.addTest(new TestQvtInterpreter(data)); - } +@RunWith(Suite.class) +@SuiteClasses({TestFailedTransformation.class, TestQvtInterpreter.class, TestIncorrectTransformation.class, TestStackTrace.class, TestInvalidConfigProperty.class, TestBlackboxLibContext.class}) +public class TransformTests extends TestCase { - suite.addTest(new TestIncorrectTransformation( - new ReferencedProjectData("bug433937_wrongImport", "bug433937_referenced", false) { //$NON-NLS-1$ //$NON-NLS-2$ - @Override - public boolean isUseCompiledXmi() { - // TODO it should be possible to run this test with the - // using of compiled XMI - return false; - } - })); - suite.addTest(new TestIncorrectTransformation( - new ReferencedProjectData("bug433937_wrongImport", "bug433937_referenced", true) { //$NON-NLS-1$ //$NON-NLS-2$ - @Override - public boolean isUseCompiledXmi() { - // TODO it should be possible to run this test with the - // using of compiled XMI - return false; - } - })); - - suite.addTestSuite(TestStackTrace.class); - suite.addTestSuite(TestInvalidConfigProperty.class); - suite.addTestSuite(TestBlackboxLibContext.class); - - return suite; - } - - public static TestSuite javalessSuite() { - TestSuite suite = new TestSuite("QVT javaless"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - for (ModelTestData data : datas) { - if(!JAVALESS_EXCLUDES.contains(data.getName()) && JavalessUtil.isValidJavalessData(data)) { - JavalessQvtTest test = new JavalessQvtTest(data, JAVALESS_PATCH_OUTPUT.contains(data.getName())); - suite.addTest(test); - } - } - - return suite; - } - - public static TestSuite walkerSuite() { - TestSuite suite = new TestSuite("QVT walker"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - for (ModelTestData data : datas) { - suite.addTest(new TestQvtWalker(data)); - } - - return suite; - } - - public static TestSuite executorSuite() { - TestSuite suite = new TestSuite("QVT executor"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - for (ModelTestData data : datas) { - suite.addTest(new TestQvtExecutor(data)); - } - - return suite; - } - - public static TestSuite debugExecutorSuite() { - TestSuite suite = new TestSuite("QVT debug executor"); //$NON-NLS-1$ - - ModelTestData[] datas = createTestData(); - - for (ModelTestData data : datas) { - suite.addTest(new DebugExecutorTest(data)); - } - - return suite; - } - - public static ModelTestData[] createTestData() { return new ModelTestData[] { new FilesToFilesData("dicttype"), //$NON-NLS-1$ @@ -189,7 +75,7 @@ public class TransformTests { new FilesToFilesData("subobjects", Arrays.asList("in.ecore"), Collections.<String>emptyList()), //$NON-NLS-1$ //$NON-NLS-2$ new FileToFileData("virtual_contextVsOverride"), //$NON-NLS-1$ new FileToFileData("numconversion", "in.xmi", "expected.pack").includeMetamodelFile("mm.ecore"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - new FilesToFilesData("bug329971", Arrays.asList("Class1.xmi"), Collections.<String>emptyList()).includeMetamodelFile("test1.ecore"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + //new FilesToFilesData("bug329971", Arrays.asList("Class1.xmi"), Collections.<String>emptyList()).includeMetamodelFile("test1.ecore"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ new FileToFileData("overload_205062"), //$NON-NLS-1$ new FileToFileData("overload_singleParam"), //$NON-NLS-1$ new FileToFileData("overload_multipleParams"), //$NON-NLS-1$ @@ -671,49 +557,5 @@ public class TransformTests { }; } - private static final Set<String> JAVALESS_EXCLUDES = new HashSet<String>(Arrays.asList(new String[] { - // uses getDataTypeInstance() defined on ecore - "primtypesecore", //$NON-NLS-1$ - - // failed to save compiled XMI (ocl problems) - "operation_override", "import_access_extends", "import_access_extends_cfgprop", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - // fqn access are not correctly patched - "importedInstances", "fqn_noncontextual", "fqnOperationCalls_271789", "fqnMainCalls_271987", "fqnMainCalls_272937", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "transf_inheritance", //$NON-NLS-1$ - - // input models use reference that is not in required format: eSuperTypes = "#//NEW_Class1" instead of "//@eClassifiers.0" - "assigntonullowner", //$NON-NLS-1$ - "resolveall", //$NON-NLS-1$ - "bug420970", //$NON-NLS-1$ - "bug467600", //$NON-NLS-1$ - - // uses getEClassifier() defined on ecore - "bug2787", "bug2839", "bug2437_4", "bug2437_5", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - // invoking ecore-specific blackbox operations, which cause mismatching param types in javaless mode - "blackboxlib_237781", //$NON-NLS-1$ - "uml2_stereotypeApplication", //$NON-NLS-1$ - "bug289982_importless", //$NON-NLS-1$ - "bug289982", //$NON-NLS-1$ - "bug326871", //$NON-NLS-1$ - "bug326871a", //$NON-NLS-1$ - "bug466705", //$NON-NLS-1$ - "blackboxlib_annotation_java", //$NON-NLS-1$ - - // EObjects are created inside blackbox transformation and later merged with javaless objects - "bug427237a", //$NON-NLS-1$ - - // EObjects for incremental update are loaded from original 'in.ecore' so they don't match with those from 'in.ecore.javaless' - "bug463572", //$NON-NLS-1$ - - // use of Eclipse project references requires patching across multiple projects - "bug433937", //$NON-NLS-1$ - - })); - - private static final Set<String> JAVALESS_PATCH_OUTPUT = new HashSet<String>(Arrays.asList(new String[] { - // EObjects are created inside blackbox transformation thus don't belong to javaless package - "bug427237", //$NON-NLS-1$ - })); + } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ApiTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ApiTestCase.java index bd1457af4..bbfab7165 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ApiTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ApiTestCase.java @@ -25,6 +25,8 @@ import org.eclipse.m2m.tests.qvt.oml.AllTests; import org.eclipse.m2m.tests.qvt.oml.TestProject; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; +import org.junit.After; +import org.junit.Before; import junit.framework.TestCase; @@ -39,16 +41,13 @@ public class ApiTestCase extends TestCase { super(data.getName()); myData = data; } - - public ApiTestCase(String testName) { - this(QvtoTransfHelperTests.getTestData(testName)); - } - + protected static String extractTestDataName(String testName, String prefix) { return testName.startsWith(prefix) ? testName.substring(prefix.length()) : testName; } @Override + @Before public void setUp() throws Exception { TestUtil.turnOffAutoBuilding(); @@ -63,6 +62,7 @@ public class ApiTestCase extends TestCase { } @Override + @After public void tearDown() throws Exception { //+myProject.delete(); } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecDeployedTransformationTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecDeployedTransformationTestCase.java index 779e770f0..9e83ae6bd 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecDeployedTransformationTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecDeployedTransformationTestCase.java @@ -11,54 +11,66 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform.api; +import java.util.Arrays; +import java.util.Collections; + import org.eclipse.emf.common.util.URI; import org.eclipse.m2m.internal.qvt.oml.common.MDAConstants; import org.eclipse.m2m.tests.qvt.oml.AllTests; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests.ApiTestData; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ +@RunWith(Parameterized.class) public class ExecDeployedTransformationTestCase extends ExecTransformationTestCase { private static final String TEST_PREFIX = "deployed_"; private static final String TEST_USEFILE_PREFIX = "file_deployed_"; - + @RunWith(Parameterized.class) public static class UseFileName extends ExecDeployedTransformationTestCase { public UseFileName(ModelTestData data) { - super(true, data); + super(data); + myUseFilename = true; setName(TEST_USEFILE_PREFIX + getData().getName()); } - - public UseFileName(String testName) { - super(extractTestDataName(testName, TEST_USEFILE_PREFIX)); - myUseFilename = true; - setName(TEST_USEFILE_PREFIX + getData().getName()); + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.<ModelTestData>asList( + new ApiTestData("exec1", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + new ApiTestData("exec2", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + new ApiTestData("exec3", Collections.<String>emptyList(), Collections.<String>emptyList()), //$NON-NLS-1$ + new ApiTestData("exec3_withImport", Collections.<String>emptyList(), Collections.<String>emptyList()) //$NON-NLS-1$ + ); } } - - public ExecDeployedTransformationTestCase(String testName) { - super(extractTestDataName(testName, TEST_PREFIX)); - myUseFilename = false; - setName(TEST_PREFIX + getData().getName()); //$NON-NLS-1$ - } - + public ExecDeployedTransformationTestCase(ModelTestData data) { - this(false, data); + super(data); + myUseFilename = false; + setName(TEST_PREFIX + data.getName()); //$NON-NLS-1$ + } + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.<ModelTestData>asList( + new ApiTestData("exec1", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + new ApiTestData("exec3", Collections.<String>emptyList(), Collections.<String>emptyList()), //$NON-NLS-1$ + new ApiTestData("exec3_withImport", Collections.<String>emptyList(), Collections.<String>emptyList()) //$NON-NLS-1$ + ); } protected String getPrefix() { return TEST_PREFIX; } - - private ExecDeployedTransformationTestCase(boolean useFilename, ModelTestData data) { - super(data); - myUseFilename = useFilename; - setName(TEST_PREFIX + data.getName()); //$NON-NLS-1$ - } @Override protected URI createScriptUri(String scriptName) { diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecTransformationTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecTransformationTestCase.java index 720d0d11f..33c0be681 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecTransformationTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ExecTransformationTestCase.java @@ -12,6 +12,7 @@ package org.eclipse.m2m.tests.qvt.oml.transform.api; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -31,23 +32,35 @@ import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper.ModelExtent import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper.TransfExecutionResult; import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationValidator; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests.ApiTestData; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ @SuppressWarnings("deprecation") +@RunWith(Parameterized.class) public class ExecTransformationTestCase extends ApiTestCase { - public ExecTransformationTestCase(String testName) { - super(testName); - } - public ExecTransformationTestCase(ModelTestData data) { super(data); setName("workspace: " + data.getName()); //$NON-NLS-1$ } + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Arrays.<ModelTestData>asList( + new ApiTestData("exec1", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + new ApiTestData("exec2", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + new ApiTestData("exec3", Collections.<String>emptyList(), Collections.<String>emptyList()) //$NON-NLS-1$ + ); + } @Override + @Test public void runTest() throws Exception { URI scriptUri = createScriptUri(getData().getName()); validateScript(scriptUri); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ImportedTransfTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ImportedTransfTestCase.java index 9fe9e7c4f..c1aa417c5 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ImportedTransfTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/ImportedTransfTestCase.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform.api; +import java.util.Arrays; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -19,22 +21,30 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.m2m.internal.qvt.oml.common.MDAConstants; import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests.ApiTestData; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ @SuppressWarnings("deprecation") +@RunWith(Parameterized.class) public class ImportedTransfTestCase extends ApiTestCase { public ImportedTransfTestCase(ModelTestData data) { super(data); } - - public ImportedTransfTestCase(String testName) { - super(testName); + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Collections.<ModelTestData>singletonList(new ApiTestData("imports", Collections.<String>emptyList(), Arrays.asList("imports.qvto", "q1.qvto", "q2.qvto", "nested2/q4.qvto", "nested/q3.qvto"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } @Override + @Test public void runTest() throws Exception { IFile qvtoFile = getIFile(getData().getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InoutValidationTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InoutValidationTestCase.java index 66da1530b..dc8d4ec48 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InoutValidationTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InoutValidationTestCase.java @@ -11,30 +11,39 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform.api; +import java.util.Collections; + import org.eclipse.core.resources.IFile; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.m2m.internal.qvt.oml.emf.util.EmfUtil; import org.eclipse.m2m.tests.qvt.oml.AllTests; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests.ApiTestData; import org.eclipse.m2m.tests.qvt.oml.util.CustomEmfResourceFactory; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ +@RunWith(Parameterized.class) public class InoutValidationTestCase extends ApiTestCase { public InoutValidationTestCase(ModelTestData data) { super(data); } - @Override - protected void runTest() throws Throwable { - testEmptyModel(); - testNonEmptyModel(); - testInvalidModel(); + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Collections.<ModelTestData>singletonList( + new ApiTestData("inoutModels", Collections.<String>emptyList(), Collections.<String>emptyList()) //$NON-NLS-1$ + ); } - + + @Test public void testEmptyModel() { { URI uri = createWorkspaceUri("empty.ecore"); //$NON-NLS-1$ @@ -61,7 +70,8 @@ public class InoutValidationTestCase extends ApiTestCase { assertTrue(EmfUtil.isUriExistsAsEObject(uri, new ResourceSetImpl(), false)); } } - + + @Test public void testNonEmptyModel() { { URI uri = createWorkspaceUri("nonEmpty.ecore"); //$NON-NLS-1$ @@ -89,6 +99,7 @@ public class InoutValidationTestCase extends ApiTestCase { } } + @Test public void testInvalidModel() { { URI uri = createWorkspaceUri("invalid.ecore"); //$NON-NLS-1$ diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InputExtensionsTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InputExtensionsTestCase.java index 794fec33d..6f3ab8e82 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InputExtensionsTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/InputExtensionsTestCase.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform.api; +import java.util.Arrays; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -19,24 +21,32 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.m2m.internal.qvt.oml.common.MDAConstants; import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests.ApiTestData; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ @SuppressWarnings("deprecation") +@RunWith(Parameterized.class) public class InputExtensionsTestCase extends ApiTestCase { - public InputExtensionsTestCase(String testName) { - super(testName); - } - public InputExtensionsTestCase(ModelTestData data) { super(data); } + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Collections.<ModelTestData>singletonList(new ApiTestData("twoInputs", Arrays.asList("in.simpleuml", "in.rdb"), Arrays.asList("out.ecore"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$) + } @Override + @Test public void runTest() throws Exception { IFile qvtoFile = getIFile(getData().getName() + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT); diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/QvtoTransfHelperTests.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/QvtoTransfHelperTests.java index ffe26b00f..f68c52a60 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/QvtoTransfHelperTests.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/QvtoTransfHelperTests.java @@ -13,98 +13,25 @@ package org.eclipse.m2m.tests.qvt.oml.transform.api; import java.io.File; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.m2m.tests.qvt.oml.AllTests; import org.eclipse.m2m.tests.qvt.oml.transform.FilesToFilesData; -import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; import org.eclipse.m2m.tests.qvt.oml.transform.api.ExecDeployedTransformationTestCase.UseFileName; import org.eclipse.m2m.tests.qvt.oml.util.TestUtil; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; /** * @author sboyko */ +@RunWith(Suite.class) +@SuiteClasses({InputExtensionsTestCase.class, ExecTransformationTestCase.class, ExecDeployedTransformationTestCase.class, UseFileName.class, WrappedExecTransformationTestCase.class, InoutValidationTestCase.class}) public class QvtoTransfHelperTests { - public static Test suite() { - return interpreterSuite(); - } - - public static TestSuite interpreterSuite() { - TestSuite suite = new TestSuite("QVT transformation api tests"); //$NON-NLS-1$ - - ApiTestCase[] apiTests = createApiTests(); - for (ApiTestCase apiTestCase : apiTests) { - suite.addTest(apiTestCase); - } - - return suite; - } - - static ModelTestData getTestData(String testName) { - ModelTestData modelTestData = createApiTestsMap().get(testName); - TestCase.assertNotNull("There must be test data added for test: " + testName, modelTestData); //$NON-NLS-1$ - return modelTestData; - } - - static LinkedHashMap<String, ModelTestData> createApiTestsMap() { - LinkedHashMap<String, ModelTestData> testMap = new LinkedHashMap<String, ModelTestData>(); - ApiTestCase[] aApiTests = createApiTests(); - for (ApiTestCase apiTestCase : aApiTests) { - String testName = apiTestCase.getData().getName(); - testMap.put(testName, apiTestCase.getData()); - } - return testMap; - } - - private static ApiTestCase[] createApiTests() { - //LinkedHashMap<String, ? extends ApiTestCase> testMap = new LinkedHashMap<String, ApiTestCase>(); - ApiTestCase[] testCases = new ApiTestCase[] { - new InputExtensionsTestCase( - new ApiTestData("twoInputs", Arrays.asList("in.simpleuml", "in.rdb"), Arrays.asList("out.ecore"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - new ImportedTransfTestCase( - new ApiTestData("imports", Collections.<String>emptyList(), Arrays.asList("imports.qvto", "q1.qvto", "q2.qvto", "nested2/q4.qvto", "nested/q3.qvto"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - - new ExecTransformationTestCase( - new ApiTestData("exec1", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - new ExecTransformationTestCase( - new ApiTestData("exec2", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - new ExecTransformationTestCase( - new ApiTestData("exec3", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - - new ExecDeployedTransformationTestCase( - new ApiTestData("exec1", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - new ExecDeployedTransformationTestCase( - new ApiTestData("exec3", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - new ExecDeployedTransformationTestCase( - new ApiTestData("exec3_withImport", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - - new UseFileName( - new ApiTestData("exec1", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - new UseFileName( - new ApiTestData("exec2", Arrays.asList("in1.ecore", "in2.ecore"), Arrays.asList("expected.simpleuml", "expected.rdb"))), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - new UseFileName( - new ApiTestData("exec3", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - new UseFileName( - new ApiTestData("exec3_withImport", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - new WrappedExecTransformationTestCase( - new ApiTestData("exec_erroneous", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - - new InoutValidationTestCase( - new ApiTestData("inoutModels", Collections.<String>emptyList(), Collections.<String>emptyList())), //$NON-NLS-1$ - }; - - return testCases; - } - private static class ApiTestData extends FilesToFilesData { + static class ApiTestData extends FilesToFilesData { public ApiTestData(String name, List<String> fromFiles, List<String> expectedFiles) { super(name, fromFiles, expectedFiles); } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/WrappedExecTransformationTestCase.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/WrappedExecTransformationTestCase.java index da836ac0d..f64b64a88 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/WrappedExecTransformationTestCase.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/api/WrappedExecTransformationTestCase.java @@ -11,28 +11,38 @@ *******************************************************************************/ package org.eclipse.m2m.tests.qvt.oml.transform.api; +import java.util.Collections; + import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationValidator; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; +import org.eclipse.m2m.tests.qvt.oml.transform.api.QvtoTransfHelperTests.ApiTestData; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; /** * @author sboyko */ - +@RunWith(Parameterized.class) public class WrappedExecTransformationTestCase extends ExecDeployedTransformationTestCase { - public WrappedExecTransformationTestCase(String testName) { - super(testName); - myUseFilename = true; - } - public WrappedExecTransformationTestCase(ModelTestData data) { super(data); myUseFilename = true; } + + @Parameters(name="{0}") + public static Iterable<ModelTestData> data() { + return Collections.<ModelTestData>singletonList( + new ApiTestData("exec_erroneous", Collections.<String>emptyList(), Collections.<String>emptyList()) //$NON-NLS-1$ + ); + } @Override + @Test public void runTest() throws Exception { boolean isFailed = false; try { diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/javaless/JavalessQvtTest.java b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/javaless/JavalessQvtTest.java index b8c523f6a..1a89c7cfd 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/javaless/JavalessQvtTest.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src/org/eclipse/m2m/tests/qvt/oml/transform/javaless/JavalessQvtTest.java @@ -14,7 +14,11 @@ package org.eclipse.m2m.tests.qvt.oml.transform.javaless; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.emf.common.util.URI; @@ -23,7 +27,14 @@ import org.eclipse.m2m.internal.qvt.oml.emf.util.URIUtils; import org.eclipse.m2m.qvt.oml.util.IContext; import org.eclipse.m2m.tests.qvt.oml.transform.ModelTestData; import org.eclipse.m2m.tests.qvt.oml.transform.TestQvtInterpreter; +import org.eclipse.m2m.tests.qvt.oml.transform.TransformTests; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +@RunWith(Parameterized.class) public class JavalessQvtTest extends TestQvtInterpreter { private static final String PREFIX = "javaless_"; //$NON-NLS-1$ @@ -36,6 +47,34 @@ public class JavalessQvtTest extends TestQvtInterpreter { isPatchOutput = patchOutput; } + @Parameters(name="{0}, {1}") + public static Iterable<Object[]> javalessData() { + ModelTestData[] rawData = TransformTests.createTestData(); + List<Object[]> data = new ArrayList<Object[]>(rawData.length); + + for (ModelTestData d : rawData) { + if(!JAVALESS_EXCLUDES.contains(d.getName()) && JavalessUtil.isValidJavalessData(d)) { + data.add( + new Object[] {d, JAVALESS_PATCH_OUTPUT.contains(d.getName())} + ); + }; + } + + return data; + } + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + } + + @Override + @Test + public void runTest() throws Exception { + super.runTest(); + } + public static JavalessFilesToFilesData createJavalessData(ModelTestData testData) { if(testData instanceof JavalessFilesToFilesData) { return (JavalessFilesToFilesData) testData; @@ -71,4 +110,50 @@ public class JavalessQvtTest extends TestQvtInterpreter { FileUtil.setContents(file, new ByteArrayInputStream(contents.getBytes(ModelTestData.ENCODING))); } } + + private static final Set<String> JAVALESS_EXCLUDES = new HashSet<String>(Arrays.asList(new String[] { + // uses getDataTypeInstance() defined on ecore + "primtypesecore", //$NON-NLS-1$ + + // failed to save compiled XMI (ocl problems) + "operation_override", "import_access_extends", "import_access_extends_cfgprop", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + // fqn access are not correctly patched + "importedInstances", "fqn_noncontextual", "fqnOperationCalls_271789", "fqnMainCalls_271987", "fqnMainCalls_272937", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "transf_inheritance", //$NON-NLS-1$ + + // input models use reference that is not in required format: eSuperTypes = "#//NEW_Class1" instead of "//@eClassifiers.0" + "assigntonullowner", //$NON-NLS-1$ + "resolveall", //$NON-NLS-1$ + "bug420970", //$NON-NLS-1$ + "bug467600", //$NON-NLS-1$ + + // uses getEClassifier() defined on ecore + "bug2787", "bug2839", "bug2437_4", "bug2437_5", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + // invoking ecore-specific blackbox operations, which cause mismatching param types in javaless mode + "blackboxlib_237781", //$NON-NLS-1$ + "uml2_stereotypeApplication", //$NON-NLS-1$ + "bug289982_importless", //$NON-NLS-1$ + "bug289982", //$NON-NLS-1$ + "bug326871", //$NON-NLS-1$ + "bug326871a", //$NON-NLS-1$ + "bug466705", //$NON-NLS-1$ + "blackboxlib_annotation_java", //$NON-NLS-1$ + + // EObjects are created inside blackbox transformation and later merged with javaless objects + "bug427237a", //$NON-NLS-1$ + + // EObjects for incremental update are loaded from original 'in.ecore' so they don't match with those from 'in.ecore.javaless' + "bug463572", //$NON-NLS-1$ + + // use of Eclipse project references requires patching across multiple projects + "bug433937", //$NON-NLS-1$ + + })); + + private static final Set<String> JAVALESS_PATCH_OUTPUT = new HashSet<String>(Arrays.asList(new String[] { + // EObjects are created inside blackbox transformation thus don't belong to javaless package + "bug427237", //$NON-NLS-1$ + })); } diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/GenericCls.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/GenericCls.java index 349c40222..0b3bc4346 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/GenericCls.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/GenericCls.java @@ -3,7 +3,6 @@ package generics; import org.eclipse.emf.common.util.EList; - import org.eclipse.emf.ecore.EObject; /** diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericClsImpl.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericClsImpl.java index ad376a9d9..cae0b1c7b 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericClsImpl.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericClsImpl.java @@ -2,19 +2,16 @@ */ package generics.impl; -import generics.GenericCls; -import generics.GenericsPackage; - import java.util.Collection; import org.eclipse.emf.common.util.EList; - import org.eclipse.emf.ecore.EClass; - import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; - import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import generics.GenericCls; +import generics.GenericsPackage; + /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Generic Cls</b></em>'. diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsFactoryImpl.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsFactoryImpl.java index 012118ec8..1e2a44684 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsFactoryImpl.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsFactoryImpl.java @@ -2,17 +2,17 @@ */ package generics.impl; -import generics.*; - import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; - import org.eclipse.emf.ecore.impl.EFactoryImpl; - import org.eclipse.emf.ecore.plugin.EcorePlugin; +import generics.GenericCls; +import generics.GenericsFactory; +import generics.GenericsPackage; + /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsPackageImpl.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsPackageImpl.java index fce43119f..17b175183 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsPackageImpl.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/impl/GenericsPackageImpl.java @@ -2,19 +2,18 @@ */ package generics.impl; -import generics.GenericCls; -import generics.GenericsFactory; -import generics.GenericsPackage; - import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EGenericType; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.ETypeParameter; - import org.eclipse.emf.ecore.impl.EPackageImpl; +import generics.GenericCls; +import generics.GenericsFactory; +import generics.GenericsPackage; + /** * <!-- begin-user-doc --> * An implementation of the model <b>Package</b>. diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsAdapterFactory.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsAdapterFactory.java index 763cc5668..d9f20dc3c 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsAdapterFactory.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsAdapterFactory.java @@ -2,15 +2,14 @@ */ package generics.util; -import generics.*; - import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; - import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - import org.eclipse.emf.ecore.EObject; +import generics.GenericCls; +import generics.GenericsPackage; + /** * <!-- begin-user-doc --> * The <b>Adapter Factory</b> for the model. diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsSwitch.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsSwitch.java index 110a576ae..a798d9661 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsSwitch.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/generics/util/GenericsSwitch.java @@ -2,13 +2,13 @@ */ package generics.util; -import generics.*; - import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; - import org.eclipse.emf.ecore.util.Switch; +import generics.GenericCls; +import generics.GenericsPackage; + /** * <!-- begin-user-doc --> * The <b>Switch</b> for the model's inheritance hierarchy. diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/NumbersImpl.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/NumbersImpl.java index 90561db6a..e48bbaaf2 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/NumbersImpl.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/NumbersImpl.java @@ -10,9 +10,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.ecore.EClass; - import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/TestqvtFactoryImpl.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/TestqvtFactoryImpl.java index 1595fb596..4d312b1c0 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/TestqvtFactoryImpl.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/impl/TestqvtFactoryImpl.java @@ -17,10 +17,10 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; import org.eclipse.emf.ecore.plugin.EcorePlugin; -import testqvt.*; import testqvt.BooleanElement; import testqvt.Element; import testqvt.Model; +import testqvt.Numbers; import testqvt.TestqvtFactory; import testqvt.TestqvtPackage; diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtAdapterFactory.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtAdapterFactory.java index c872f5e75..3ff28369f 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtAdapterFactory.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtAdapterFactory.java @@ -16,10 +16,10 @@ import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; import org.eclipse.emf.ecore.EObject; -import testqvt.*; import testqvt.BooleanElement; import testqvt.Element; import testqvt.Model; +import testqvt.Numbers; import testqvt.TestqvtPackage; /** diff --git a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtSwitch.java b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtSwitch.java index 6f84b4788..4279024c6 100644 --- a/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtSwitch.java +++ b/tests/org.eclipse.m2m.tests.qvt.oml/src_generated/testqvt/util/TestqvtSwitch.java @@ -16,10 +16,10 @@ import java.util.List; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import testqvt.*; import testqvt.BooleanElement; import testqvt.Element; import testqvt.Model; +import testqvt.Numbers; import testqvt.TestqvtPackage; /** |