| author | skovalsky | 2012-05-13 19:40:48 (EDT) |
|---|---|---|
| committer | mgolubev | 2012-05-13 19:40:48 (EDT) |
| commit | 316fd337bbc58d1ff03f7e1e52d6c400bd3dbcc7 (patch) (side-by-side diff) | |
| tree | a3dd45285175a44b02dd81cfb7afb633d5ac8c7b | |
| parent | a69208cc6afb322c3e65804253dba973b05c12e2 (diff) | |
| download | org.eclipse.gmf-tooling-316fd337bbc58d1ff03f7e1e52d6c400bd3dbcc7.zip org.eclipse.gmf-tooling-316fd337bbc58d1ff03f7e1e52d6c400bd3dbcc7.tar.gz org.eclipse.gmf-tooling-316fd337bbc58d1ff03f7e1e52d6c400bd3dbcc7.tar.bz2 | |
[379358] Fixed: ParserTest fails under GMF 3.0M7
3 files changed, 29 insertions, 26 deletions
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java index 836d292..e087325 100644 --- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java +++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java @@ -86,8 +86,7 @@ public class AllTests { System.err.println("Generating a target platform"); Utils.setTargetPlatform(); } - - + TestSuite suite = new TestSuite("Tests for org.eclipse.gmf, tooling side"); final SessionSetup sessionSetup = SessionSetup.newInstance(); final LinksSessionSetup sessionSetup2 = LinksSessionSetup.newInstance(); @@ -97,16 +96,15 @@ public class AllTests { // subclassing to generate extra code final SessionSetup setupEditHelpersTest = new EditHelpersTest.EditHelpersSessionSetup(); final SessionSetup setupBundleActivationTest = new BundleActivationTest.CustomSetup(); - + SessionSetup.disallowSingleTestCaseUse(); - JavaCore.initializeAfterLoad(null); /* - * Temporary workaround: loading all the projects in the - * beginning to get rid of the problems with runtime registries - * reloading. In particular - ViewService. + * Temporary workaround: loading all the projects in the beginning to + * get rid of the problems with runtime registries reloading. In + * particular - ViewService. */ // since we force initialization, need to make sure our tests would use same initialized setup instances. Plugin.getConfig().registerInstance(SessionSetup.class, sessionSetup); @@ -146,10 +144,10 @@ public class AllTests { suite.addTestSuite(TestDefaultMergeService.class); suite.addTestSuite(PluginXMLTextMergerTest.class); suite.addTestSuite(ManifestMergeTest.class); - suite.addTestSuite(OrganizeImportsPostprocessorTest.class); + suite.addTestSuite(OrganizeImportsPostprocessorTest.class); suite.addTestSuite(EcoreGenModelMatcherTest.class); - suite.addTestSuite(ModelLoadHelperTest.class); + suite.addTestSuite(ModelLoadHelperTest.class); suite.addTest(AllMigrationTests.suite()); suite.addTest(AllValidateTests.suite()); @@ -163,14 +161,14 @@ public class AllTests { suite.addTestSuite(MapModeStrategyTest.class); suite.addTestSuite(ViewmapProducersTest.class); suite.addTestSuite(ToolDefHandocodedImplTest.class); - suite.addTestSuite(AuditHandcodedTest.class); - suite.addTestSuite(AuditRulesTest.class); + suite.addTestSuite(AuditHandcodedTest.class); + suite.addTestSuite(AuditRulesTest.class); suite.addTestSuite(ElementInitializerTest.class); suite.addTestSuite(CodegenReconcileTest.class); // though it might be an overkill to check two setups, it should be fast and won't hurt. suite.addTest(feed(TestAllDerivedFeatures.class, sessionSetup, "-SessionSetup")); suite.addTest(feed(TestAllDerivedFeatures.class, sessionSetup2, "-LinksSessionSetup")); - + suite.addTestSuite(DiagramNodeTest.class); suite.addTestSuite(CompartmentPropertiesTest.class); suite.addTestSuite(NamingStrategyTest.class); @@ -189,19 +187,19 @@ public class AllTests { suite.addTestSuite(LinkCreationTest.class); suite.addTestSuite(LinkCreationConstraintsTest.class); - suite.addTestSuite(MetricRulesTest.class); + suite.addTestSuite(MetricRulesTest.class); suite.addTestSuite(GenFeatureSeqInitializerTest.class); suite.addTestSuite(GenModelGraphAnalyzerTest.class); suite.addTestSuite(EditHelpersTest.class); - //suite.addTest(feed(ParsersTest.class, new ParsersSetup(false), "-direct")); - //suite.addTest(feed(ParsersTest.class, new ParsersSetup(true), "-provider")); + suite.addTest(feed(ParsersTest.class, new ParsersSetup(false), "-direct")); + suite.addTest(feed(ParsersTest.class, new ParsersSetup(true), "-provider")); // slowest test goes last suite.addTestSuite(RuntimeCompilationTest.class); - //$JUnit-END$ suite.addTest(new CleanupTest("testCleanup") { + protected void performCleanup() throws Exception { sessionSetup.cleanup(); sessionSetup2.cleanup(); @@ -211,7 +209,7 @@ public class AllTests { setupBundleActivationTest.cleanup(); } }); - + return suite; } @@ -231,7 +229,7 @@ public class AllTests { c.register(GenModelTransformerSimpleTest.class, SessionSetup.class); c.register(LabelMappingTransformTest.class, SessionSetup.class); c.register(PaletteTransformationTest.class, SessionSetup.class); - c.register(AuditHandcodedTest.class, SessionSetup.class); + c.register(AuditHandcodedTest.class, SessionSetup.class); c.register(CodegenReconcileTest.class, SessionSetup.class); // Default configuration, TestAllDerivedFeatures also runs for LinksSessionSetup c.register(TestAllDerivedFeatures.class, SessionSetup.class); diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java index 63b8236..83efec5 100644 --- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java +++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java @@ -525,8 +525,11 @@ public class ParsersTest extends TestCase { final PredefinedParser printfRegexParser = GMFGenFactory.eINSTANCE.createPredefinedParser(); printfRegexParser.setViewMethod(LabelTextAccessMethod.PRINTF); printfRegexParser.setEditMethod(LabelTextAccessMethod.REGEXP); + final CustomParser customParser = GMFGenFactory.eINSTANCE.createCustomParser(); customParser.setQualifiedName(diagramkin.getEditPartsPackageName() + ".MyCustomParser"); + customParser.setGenerateBoilerplate(false); // because we will generate this class externally, see ParsersSetup#GenProjectSetup#hookExtraCodeGeneration + final ExternalParser externalParser = GMFGenFactory.eINSTANCE.createExternalParser(); externalParser.setHint("\"Description\""); // value of CommonParserHint.DESCIPTION constant, // not the constant itself to manually (visually) assure (in the generated class) the hint is being used. diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java index d9ce324..a73e74f 100644 --- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java +++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java @@ -29,6 +29,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; import org.eclipse.gmf.tests.Plugin; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; /** * Running tests within PDE, we face two major problems: @@ -79,10 +80,10 @@ public class RuntimeWorkspaceSetup { List<String> l = Arrays.asList(Platform.getCommandLineArgs()); int i; if ((i = l.indexOf("-dev")) != -1) { - isDevBinPresent = i + 1 < l.size() && l.get(i+1).startsWith("bin"); + isDevBinPresent = i + 1 < l.size() && l.get(i + 1).startsWith("bin"); } else { String osgiDevProp = Plugin.getBundleContext().getProperty("osgi.dev"); - isDevBinPresent = osgiDevProp!= null && osgiDevProp.contains("bin"); + isDevBinPresent = osgiDevProp != null && osgiDevProp.contains("bin"); } } @@ -145,13 +146,14 @@ public class RuntimeWorkspaceSetup { /** * at least 1.4 */ + @SuppressWarnings("restriction") private static void ensureJava14() { - if (!JavaCore.VERSION_1_4.equals(JavaCore.getOption(JavaCore.COMPILER_SOURCE))) { + String actual = JavaCore.getOption(JavaCore.COMPILER_SOURCE); + long comparableValue = CompilerOptions.versionToJdkLevel(actual); + if (comparableValue < CompilerOptions.versionToJdkLevel(JavaCore.VERSION_1_4)) { @SuppressWarnings("unchecked") - Hashtable<String,String> options = JavaCore.getOptions(); - options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); - options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4); - options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4); + Hashtable<String, String> options = JavaCore.getOptions(); + JavaCore.setComplianceOptions(JavaCore.VERSION_1_4, options); JavaCore.setOptions(options); } } @@ -163,7 +165,7 @@ public class RuntimeWorkspaceSetup { wd.setFileStateLongevity(0); wd.setMaxFileStates(0); wd.setMaxFileStateSize(0); - wd.setSnapshotInterval(60*60*1000); + wd.setSnapshotInterval(60 * 60 * 1000); } private static void switchAutobuildOff(IWorkspaceDescription wd) { |

