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 66684 Details for
Bug 177676
[JUnit] Problems with JUnits with multiple versions of same bundle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
177676.patch (text/plain), 6.65 KB, created by
Martin Aeschlimann
on 2007-05-10 10:41:30 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Martin Aeschlimann
Created:
2007-05-10 10:41:30 EDT
Size:
6.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.junit >Index: src/org/eclipse/jdt/internal/junit/buildpath/JUnitHomeInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/buildpath/JUnitHomeInitializer.java,v >retrieving revision 1.1 >diff -u -r1.1 JUnitHomeInitializer.java >--- src/org/eclipse/jdt/internal/junit/buildpath/JUnitHomeInitializer.java 21 Apr 2006 16:47:33 -0000 1.1 >+++ src/org/eclipse/jdt/internal/junit/buildpath/JUnitHomeInitializer.java 10 May 2007 14:01:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 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 >@@ -34,7 +34,7 @@ > > private void initializeHome() { > try { >- IPath location= BuildPathSupport.getBundleLocation(BuildPathSupport.JUNIT3_PLUGIN_ID); >+ IPath location= BuildPathSupport.getBundleLocation(BuildPathSupport.JUNIT3_PLUGIN); > if (location != null) { > JavaCore.setClasspathVariable(JUnitPlugin.JUNIT_HOME, location, null); > } else { >@@ -47,7 +47,7 @@ > > private void initializeSource() { > try { >- IPath sourceLocation= BuildPathSupport.getSourceLocation(BuildPathSupport.JUNIT3_PLUGIN_ID); >+ IPath sourceLocation= BuildPathSupport.getSourceLocation(BuildPathSupport.JUNIT3_PLUGIN); > if (sourceLocation != null) { > JavaCore.setClasspathVariable(JUnitPlugin.JUNIT_SRC_HOME, sourceLocation, null); > } else { >Index: src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java,v >retrieving revision 1.10 >diff -u -r1.10 BuildPathSupport.java >--- src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java 2 Apr 2007 14:29:05 -0000 1.10 >+++ src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java 10 May 2007 14:01:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 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 >@@ -18,6 +18,9 @@ > import org.eclipse.core.runtime.FileLocator; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; >+ >+import org.eclipse.osgi.service.resolver.VersionRange; > > import org.eclipse.jdt.core.IAccessRule; > import org.eclipse.jdt.core.IClasspathAttribute; >@@ -28,17 +31,46 @@ > import org.eclipse.jdt.internal.junit.ui.JUnitPreferencesConstants; > > import org.osgi.framework.Bundle; >+import org.osgi.framework.Version; > > /** > * > */ > public class BuildPathSupport { > >- public static final String JUNIT3_PLUGIN_ID= "org.junit"; //$NON-NLS-1$ >- public static final String JUNIT4_PLUGIN_ID= "org.junit4"; //$NON-NLS-1$ >+ private static class JUnitPluginDescription { >+ public String bundleId; >+ public VersionRange versionRange; >+ >+ public JUnitPluginDescription(String bundleId, VersionRange versionRange) { >+ this.bundleId= bundleId; >+ this.versionRange= versionRange; >+ } >+ >+ public Bundle getBundle() { >+ Bundle[] bundles= Platform.getBundles(this.bundleId, null); >+ if (bundles != null) { >+ for (int i= 0; i < bundles.length; i++) { >+ Bundle curr= bundles[i]; >+ String version= (String) curr.getHeaders().get("Bundle-Version"); //$NON-NLS-1$ >+ try { >+ if (this.versionRange.isIncluded(Version.parseVersion(version))) { >+ return curr; >+ } >+ } catch (IllegalArgumentException e) { >+ // ignore >+ } >+ } >+ } >+ return null; >+ } >+ } >+ >+ public static final JUnitPluginDescription JUNIT3_PLUGIN= new JUnitPluginDescription("org.junit", new VersionRange("[3.8.2,3.9)")); //$NON-NLS-1$ //$NON-NLS-2$ >+ public static final JUnitPluginDescription JUNIT4_PLUGIN= new JUnitPluginDescription("org.junit4", new VersionRange("[4.3.1,4.4.0)")); //$NON-NLS-1$ //$NON-NLS-2$ > >- public static IPath getBundleLocation(String bundleName) { >- Bundle bundle= JUnitPlugin.getDefault().getBundle(bundleName); >+ public static IPath getBundleLocation(JUnitPluginDescription pluginDesc) { >+ Bundle bundle= pluginDesc.getBundle(); > if (bundle == null) > return null; > >@@ -52,8 +84,8 @@ > return Path.fromOSString(fullPath); > } > >- public static IPath getSourceLocation(String bundleName) { >- Bundle bundle= JUnitPlugin.getDefault().getBundle(bundleName); >+ public static IPath getSourceLocation(JUnitPluginDescription pluginDesc) { >+ Bundle bundle= pluginDesc.getBundle(); > if (bundle == null) > return null; > >@@ -72,7 +104,7 @@ > return null; > } > String fullPath= new File(local.getPath()).getAbsolutePath() >- + File.separator + "src" + File.separator + bundleName + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$ >+ + File.separator + "src" + File.separator + pluginDesc.bundleId + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$ > return Path.fromOSString(fullPath); > } > >@@ -85,11 +117,11 @@ > } > > public static IClasspathEntry getJUnit3LibraryEntry() { >- IPath bundleBase= getBundleLocation(JUNIT3_PLUGIN_ID); >+ IPath bundleBase= getBundleLocation(JUNIT3_PLUGIN); > if (bundleBase != null) { > IPath jarLocation= bundleBase.append("junit.jar"); //$NON-NLS-1$ > >- IPath sourceBase= getSourceLocation(JUNIT3_PLUGIN_ID); >+ IPath sourceBase= getSourceLocation(JUNIT3_PLUGIN); > IPath srcLocation= sourceBase != null ? sourceBase.append("junitsrc.zip") : null; //$NON-NLS-1$ > > IAccessRule[] accessRules= { }; >@@ -103,11 +135,11 @@ > } > > public static IClasspathEntry getJUnit4LibraryEntry() { >- IPath bundleBase= getBundleLocation(JUNIT4_PLUGIN_ID); >+ IPath bundleBase= getBundleLocation(JUNIT4_PLUGIN); > if (bundleBase != null) { > IPath jarLocation= bundleBase.append("junit.jar"); //$NON-NLS-1$ > >- IPath sourceBase= getSourceLocation(JUNIT4_PLUGIN_ID); >+ IPath sourceBase= getSourceLocation(JUNIT4_PLUGIN); > IPath srcLocation= sourceBase != null ? sourceBase.append("junitsrc.zip") : null; //$NON-NLS-1$ > > IAccessRule[] accessRules= { };
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 177676
:
61024
|
66684
|
66925
|
67026