diff options
author | Mike Rennie | 2013-08-13 15:33:50 +0000 |
---|---|---|
committer | Mike Rennie | 2013-08-13 15:33:50 +0000 |
commit | 1069a6451bf19d12694a39955a0623471850aacd (patch) | |
tree | ed4db51b7d7a217ed49b2eb07ae767d1eea2a2ad | |
parent | 0f4ebf8a8b3cd164b4ca6b0d3d7318010ac61c51 (diff) | |
download | eclipse.jdt.debug-1069a6451bf19d12694a39955a0623471850aacd.tar.gz eclipse.jdt.debug-1069a6451bf19d12694a39955a0623471850aacd.tar.xz eclipse.jdt.debug-1069a6451bf19d12694a39955a0623471850aacd.zip |
Bug 414939 - Error when checking outI20130813-1330I20130813-1200
'org.eclipse.debug.examples.mixedmode' example
Change-Id: Id327e7249920d91c0236066ccb475e52dab8edd1
Signed-off-by: Mike Rennie <Michael_Rennie@ca.ibm.com>
4 files changed, 42 insertions, 11 deletions
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java index fc22b3225..a6a12312f 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java @@ -16,6 +16,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -2354,6 +2355,12 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation ILaunchConfigurationWorkingCopy config = type.newInstance(project.getProject().getFolder(LAUNCHCONFIGURATIONS), mainTypeName); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainTypeName); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getElementName()); + Set<String> modes = new HashSet<String>(); + modes.add(ILaunchManager.RUN_MODE); + config.setPreferredLaunchDelegate(modes, LOCAL_JAVA_APPLICATION_TYPE_ID); + modes = new HashSet<String>(); + modes.add(ILaunchManager.DEBUG_MODE); + config.setPreferredLaunchDelegate(modes, LOCAL_JAVA_APPLICATION_TYPE_ID); // use 'java' instead of 'javaw' to launch tests (javaw is problematic // on JDK1.4.2) Map<String, String> map = new HashMap<String, String>(1); @@ -2370,6 +2377,12 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation ILaunchConfigurationWorkingCopy config = type.newInstance(project.getProject().getFolder(containername), mainTypeName); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainTypeName); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getElementName()); + Set<String> modes = new HashSet<String>(); + modes.add(ILaunchManager.RUN_MODE); + config.setPreferredLaunchDelegate(modes, LOCAL_JAVA_APPLICATION_TYPE_ID); + modes = new HashSet<String>(); + modes.add(ILaunchManager.DEBUG_MODE); + config.setPreferredLaunchDelegate(modes, LOCAL_JAVA_APPLICATION_TYPE_ID); // use 'java' instead of 'javaw' to launch tests (javaw is problematic // on JDK1.4.2) Map<String, String> map = new HashMap<String, String>(1); diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/JavaLibraryPathTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/JavaLibraryPathTests.java index b2bf5c742..4d44dda18 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/JavaLibraryPathTests.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/JavaLibraryPathTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. + * Copyright (c) 2004, 2013 IBM 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 @@ -11,6 +11,7 @@ package org.eclipse.jdt.debug.tests.core; import java.io.File; +import java.util.HashSet; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; @@ -22,6 +23,7 @@ import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchDelegate; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; import org.eclipse.jdt.core.IAccessRule; @@ -42,7 +44,6 @@ import org.eclipse.jdt.launching.JavaRuntime; * * @since 3.1 */ -@SuppressWarnings("deprecation") public class JavaLibraryPathTests extends AbstractDebugTest { public JavaLibraryPathTests(String name) { @@ -123,7 +124,10 @@ public class JavaLibraryPathTests extends AbstractDebugTest { ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "testVMArgsForRequiredProjectExplicitPath"); workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "PathTests1"); - ILaunchConfigurationDelegate delegate = type.getDelegate(ILaunchManager.DEBUG_MODE); + HashSet<String> modes = new HashSet<String>(); + modes.add(ILaunchManager.DEBUG_MODE); + ILaunchDelegate d = type.getPreferredDelegate(modes); + ILaunchConfigurationDelegate delegate = d.getDelegate(); assertTrue(delegate instanceof JavaLaunchDelegate); JavaLaunchDelegate launcher = (JavaLaunchDelegate) delegate; String arguments = launcher.getVMArguments(workingCopy); @@ -145,7 +149,10 @@ public class JavaLibraryPathTests extends AbstractDebugTest { ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "testVMArgsForRequiredProjectExplicitPath"); workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "PathTests1"); - ILaunchConfigurationDelegate delegate = type.getDelegate(ILaunchManager.DEBUG_MODE); + HashSet<String> modes = new HashSet<String>(); + modes.add(ILaunchManager.DEBUG_MODE); + ILaunchDelegate d = type.getPreferredDelegate(modes); + ILaunchConfigurationDelegate delegate = d.getDelegate(); assertTrue(delegate instanceof JavaLaunchDelegate); JavaLaunchDelegate launcher = (JavaLaunchDelegate) delegate; String arguments = launcher.getVMArguments(workingCopy); diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java index 6bdd4cc92..ddc551f45 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 2013 IBM 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 @@ -49,7 +49,7 @@ public class ContributedTabTests extends AbstractDebugTest { assertNotNull("Java tab group cannot be null", javagroup); //$NON-NLS-1$ javagroup.createTabs(getLaunchConfigurationDialog(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP), ILaunchManager.DEBUG_MODE); ILaunchConfigurationTab[] tabs = javagroup.getTabs(); - assertEquals("Wrong number of tabs", 11, tabs.length); //$NON-NLS-1$ + assertTrue("Wrong number of tabs", tabs.length >= 11); //$NON-NLS-1$ Set<Class<? extends ILaunchConfigurationTab>> tabset = new HashSet<Class<? extends ILaunchConfigurationTab>>(); for(int i = 0; i < tabs.length; i++) { tabset.add(tabs[i].getClass()); @@ -69,7 +69,17 @@ public class ContributedTabTests extends AbstractDebugTest { assertNotNull("java tab group cannot be null", javagroup); //$NON-NLS-1$ javagroup.createTabs(getLaunchConfigurationDialog(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP), ILaunchManager.DEBUG_MODE); ILaunchConfigurationTab[] tabs = javagroup.getTabs(); - assertTrue("The second tab must be TestTab1", tabs[1].getClass().equals(ContributedTestTab1.class)); //$NON-NLS-1$ + int idx = 0; + boolean found = false; + for (int i = 0; i < tabs.length; i++) { + idx = i; + if (tabs[i].getClass().equals(ContributedTestTab1.class)) { + found = true; + break; + } + } + assertTrue("The TestTab1 must appear in the tab listing", found); + assertTrue("The TestTab1 must appear after the MainTab", idx > 0); //$NON-NLS-1$ } /** @@ -96,8 +106,9 @@ public class ContributedTabTests extends AbstractDebugTest { javagroup.createTabs(getLaunchConfigurationDialog(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP), ILaunchManager.DEBUG_MODE); ILaunchConfigurationTab[] tabs = javagroup.getTabs(); HashSet<Class<? extends ILaunchConfigurationTab>> tabset = new HashSet<Class<? extends ILaunchConfigurationTab>>(); - tabset.add(tabs[3].getClass()); - tabset.add(tabs[4].getClass()); + for (int i = 0; i < tabs.length; i++) { + tabset.add(tabs[i].getClass()); + } HashSet<Class<? extends ILaunchConfigurationTab>> contribs = new HashSet<Class<? extends ILaunchConfigurationTab>>(); contribs.add(ContributedTestTab2.class); contribs.add(ContributedTestTab3.class); diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/TabGroupWrapperTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/TabGroupWrapperTests.java index afc6e7a38..ab7ae889d 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/TabGroupWrapperTests.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/TabGroupWrapperTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM 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 @@ -41,7 +41,7 @@ public class TabGroupWrapperTests extends AbstractDebugTest { ILaunchConfigurationTabGroup javagroup = getJavaLaunchGroup(); assertNotNull("java tab group cannot be null", javagroup); //$NON-NLS-1$ javagroup.createTabs(getLaunchConfigurationDialog(IDebugUIConstants.ID_RUN_LAUNCH_GROUP), ILaunchManager.RUN_MODE); - assertTrue("There must be 11 tabs, 7 defaults and 4 contributed", javagroup.getTabs().length == 11); //$NON-NLS-1$ + assertTrue("There must be at least 11 tabs", javagroup.getTabs().length >= 11); //$NON-NLS-1$ } /** |