Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 113472 Details for
Bug 248466
Cannot launch if build path contains a ".." entry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
new tests for relative classpaths
rel-classpath-tests.patch (text/plain), 5.00 KB, created by
Darin Wright
on 2008-09-25 11:39:07 EDT
(
hide
)
Description:
new tests for relative classpaths
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2008-09-25 11:39:07 EDT
Size:
5.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug.tests >Index: tests/org/eclipse/jdt/debug/tests/core/ClasspathProviderTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathProviderTests.java,v >retrieving revision 1.9 >diff -u -r1.9 ClasspathProviderTests.java >--- tests/org/eclipse/jdt/debug/tests/core/ClasspathProviderTests.java 24 Feb 2005 16:28:11 -0000 1.9 >+++ tests/org/eclipse/jdt/debug/tests/core/ClasspathProviderTests.java 25 Sep 2008 15:37:44 -0000 >@@ -17,16 +17,19 @@ > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Path; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.debug.testplugin.JavaProjectHelper; > import org.eclipse.jdt.debug.tests.AbstractDebugTest; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > import org.eclipse.jdt.launching.IRuntimeClasspathEntry; > import org.eclipse.jdt.launching.IRuntimeClasspathProvider; > import org.eclipse.jdt.launching.JavaRuntime; >+import org.eclipse.jdt.launching.environments.IExecutionEnvironment; > > /** > * Tests runtime classpath provider extension point >@@ -494,4 +497,74 @@ > assertTrue("Classpath is missing " + location, list.contains(location)); > > } >+ >+ /** >+ * Tests that a buildpath with a relative (../..) classpath entry will resolve properly. >+ * >+ * @throws Exception >+ */ >+ public void testRelativeClasspathEntry() throws Exception { >+ // create a project with a relative classpath entry >+ IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RelativeCP"); >+ assertFalse("Project should not exist", pro.exists()); >+ >+ // create project with source folder and output location >+ IJavaProject project = JavaProjectHelper.createJavaProject("RelativeCP"); >+ JavaProjectHelper.addSourceContainer(project, "src", "bin"); >+ IExecutionEnvironment j2se14 = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4"); >+ assertNotNull("Missing J2SE-1.4 environment", j2se14); >+ IPath path = JavaRuntime.newJREContainerPath(j2se14); >+ JavaProjectHelper.addContainerEntry(project, path); >+ // add relative entry - point to A.jar in DebugTests/src >+ JavaProjectHelper.addLibrary(project, new Path("../DebugTests/src/A.jar")); >+ >+ // test runtime class path resolution >+ String[] entries = JavaRuntime.computeDefaultRuntimeClassPath(project); >+ String jarPath = getJavaProject().getProject().getLocation().append("src").append("A.jar").toOSString(); >+ List list = new ArrayList(); >+ for (int i = 0; i < entries.length; i++) { >+ list.add(entries[i]); >+ } >+ >+ // delete the project >+ pro.delete(false, null); >+ >+ assertTrue("Classpath is missing " + jarPath, list.contains(jarPath)); >+ } >+ >+ /** >+ * Tests that a variable with a relative (../..) path will resolve properly. >+ * >+ * @throws Exception >+ */ >+ public void testVariableWithRelativePath() throws Exception { >+ // create a project with a relative classpath entry >+ IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RelativeVar"); >+ assertFalse("Project should not exist", pro.exists()); >+ >+ // create project with source folder and output location >+ IJavaProject project = JavaProjectHelper.createJavaProject("RelativeVar"); >+ JavaProjectHelper.addSourceContainer(project, "src", "bin"); >+ IExecutionEnvironment j2se14 = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4"); >+ assertNotNull("Missing J2SE-1.4 environment", j2se14); >+ IPath path = JavaRuntime.newJREContainerPath(j2se14); >+ JavaProjectHelper.addContainerEntry(project, path); >+ // add relative entry - point to A.jar in DebugTests/src >+ String varName = "RELATIVE_DEBUG_TESTS"; >+ JavaCore.setClasspathVariable(varName, new Path("../DebugTests"), null); >+ JavaProjectHelper.addVariableEntry(project, new Path("RELATIVE_DEBUG_TESTS/src/A.jar"), null, null); >+ >+ // test runtime class path resolution >+ String[] entries = JavaRuntime.computeDefaultRuntimeClassPath(project); >+ String jarPath = getJavaProject().getProject().getLocation().append("src").append("A.jar").toOSString(); >+ List list = new ArrayList(); >+ for (int i = 0; i < entries.length; i++) { >+ list.add(entries[i]); >+ } >+ >+ // delete the project >+ pro.delete(false, null); >+ >+ assertTrue("Classpath is missing " + jarPath, list.contains(jarPath)); >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 248466
:
113471
| 113472