Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 283011 - [JUnit] JUnit does not work on multiuser install
Summary: [JUnit] JUnit does not work on multiuser install
Status: RESOLVED DUPLICATE of bug 276111
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 282944 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-07-09 09:12 EDT by Maxim Penzin CLA
Modified: 2009-07-10 09:14 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Penzin CLA 2009-07-09 09:12:35 EDT
Build ID: 20090619-0625

Steps To Reproduce:
1. Run eclipse
2. select Build Path / Add Library / JUnit / JUnit Library version 3 or 4
3. Current Location and Source Location is null


More information:
It happens when current user has no write premissions to Eclipse installation directory (/opt/eclise).

chown -R user /opt/eclipse

solves that problem but it is not acceptable for multiuser installation of Eclipse.
Comment 1 Frederic Fusier CLA 2009-07-09 09:39:52 EDT
It does not look like an Eclipse issue to me. Installing eclipse on Linux is just untar the provided gz file... So, change the access rights on the created 'eclipse' directory sounds like a "normal" administrative task to do after...

Move to Platform to decide how to close this bug (or to continue the discussion if I missed some important point here...)
Comment 2 Susan McCourt CLA 2009-07-09 11:56:04 EDT
Simon, do you have any advice on this?
Comment 3 Paul Webster CLA 2009-07-09 12:17:19 EDT
Frederic, any reason why this would fail when it is read-only?

I can reproduce easily.  In my standard eclipse the Junit 4 library shows up in the package explorer and .classpath has:
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>

In my multi-user install the .classpath has:
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>

However, the package explorer does not show "JUnit 4" under "JRE System Library".

Is JDT setting up JUnit 4 in a preference, maybe in the ConfigurationScope?

PW
Comment 4 Simon Kaegi CLA 2009-07-09 12:22:46 EDT
Shared install is my day-to-day development environment only on windows. I just tried this out and had no problems e.g. could add JUnit and had the relevant current and source locations set correctly. I'll check with one of the folk using Linux.
Comment 5 Paul Webster CLA 2009-07-09 12:29:24 EDT
(In reply to comment #3)
> Frederic, any reason why this would fail when it is read-only?

Just some more information.  If you go Properties>Java Build Path "JUnit 4" is listed under  Libraries ... but it contains no useful information (which is I guess the original problem description).

PW
Comment 6 Paul Webster CLA 2009-07-09 12:30:07 EDT
(In reply to comment #4)
> Shared install is my day-to-day development environment only on windows.

Simon, it has to be a read-only shared install.  See bug 282944 for the windows version that doesn't work.

PW
Comment 7 Simon Kaegi CLA 2009-07-09 12:40:23 EDT
Yes, Paul I know ;)

I was able to reproduce on Windows from a clean install.
As soon as I installed something though I was then able to add JUnit normally.

When a shared install comes up a bundles.info is not written and we instead
rely on the bundles.info in the shared install. Once we've done an install of
anything we then write out the user specific bundles.info. Perhaps the lookup
mechanism used to find the JUnit jars is not cascading??
Comment 8 Paul Webster CLA 2009-07-09 12:48:11 EDT
AFAICT this is done in org.eclipse.jdt.internal.junit.buildpath.BuildPathSupport.JUnitPluginDescription.getLibraryEntry() which calls into p2 methods from org.eclipse.jdt.internal.junit.buildpath.P2Utils

PW
Comment 9 Simon Kaegi CLA 2009-07-09 13:09:26 EDT
The code in P2Utils readBundles (or it's caller) needs to check the shared area if the user's bundle info is not present. There's similar code in org.eclipse.pde.internal.core.PluginPathFinder.getPluginPaths.

Obviously it would be a good thing if simple configurator exposed some API here rather than have everyone implement this logic however short term we need to fix this lookup.
Comment 10 Chris Aniszczyk CLA 2009-07-09 13:10:35 EDT
(In reply to comment #9)
> Obviously it would be a good thing if simple configurator exposed some API here
> rather than have everyone implement this logic however short term we need to
> fix this lookup.

Is there a bug to track this? The PDE team would love this API addition.
Comment 11 Paul Webster CLA 2009-07-09 13:12:57 EDT
(In reply to comment #10)
> 
> Is there a bug to track this? The PDE team would love this API addition.

bug 269496

PW
Comment 12 Paul Webster CLA 2009-07-09 13:14:57 EDT
*** Bug 282944 has been marked as a duplicate of this bug. ***
Comment 13 Frederic Fusier CLA 2009-07-10 03:59:45 EDT
(In reply to comment #5)
> (In reply to comment #3)
> > Frederic, any reason why this would fail when it is read-only?
> 
> Just some more information.  If you go Properties>Java Build Path "JUnit 4" is
> listed under  Libraries ... but it contains no useful information (which is I
> guess the original problem description).
> 
> PW
> 
I do not see any, but as now this bug is in JDT/UI inbox, I'm sure you'll get more lights on this rapidly...
Comment 14 Dani Megert CLA 2009-07-10 09:14:40 EDT
FYI: bug 276111 contains a patched jdt.junit JAR for 3.5.

*** This bug has been marked as a duplicate of bug 276111 ***