This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201117 - Option "Run focused Test", "Debug focused Test" are disabled in JUnit Test
Summary: Option "Run focused Test", "Debug focused Test" are disabled in JUnit Test
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.0.1
Hardware: PC Windows Vista
: P2 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 188163 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-19 01:15 UTC by bht
Modified: 2011-10-31 11:48 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Testcase (22.95 KB, application/octet-stream)
2011-08-19 01:17 UTC, bht
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2011-08-19 01:15:24 UTC
Please refer to the attached testcase. This appears to happen if in Project 

Properties|Build|Compiling|Compile on Save

is swiched off.

This testcase tests a standalone JPA project.

Compile on Save must be turned off in JPA projects because of issue 178535

Please note that this project requires in project properties, Run|VM Options, 
-javaagent:<Your eclipselink distribution>\jlib\eclipselink.jar
Comment 1 bht 2011-08-19 01:17:08 UTC
Created attachment 110107 [details]
Testcase
Comment 2 bht 2011-09-11 03:59:17 UTC
Another issue that requires turning off Compile on Save: Issue 201937
Comment 3 Tomas Zezula 2011-09-20 08:35:09 UTC
Caused by persistence CopyResourceIndexer.
The problem is that the CRI copies the persistence.xml from src root into cache, then the persistence.xml is copied by CoS to build/classes. The Cos CP.RUNTIME contains both build/classes and src folder because of resources in it. So there are two persistence.xml which define the same PU and eclipse link's java agent fails.
Comment 4 Tomas Zezula 2011-09-20 09:29:45 UTC
There are two possible solutions:
1st) Special case for the persistence.xml (don't copy it from cache to build folder)
2nd) Don't put the source root to CP.RUNTIME and copy the resources from sources root to build/classes (similarly as the web project is doing).  This slows down run a bit.
After discussion with Honza L. we decided for second case.
Comment 5 Tomas Zezula 2011-09-20 10:02:49 UTC
Fixed jet-main 98acb457c727
The run (debug) file now works fine with attached project.
Comment 6 Quality Engineering 2011-09-21 08:07:01 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/98acb457c727
User: Tomas Zezula <tzezula@netbeans.org>
Log: #201117:Option "Run focused Test", "Debug focused Test" are disabled in JUnit Test
Comment 7 Jan Lahoda 2011-10-16 22:30:54 UTC
*** Bug 188163 has been marked as a duplicate of this bug. ***
Comment 8 Jesse Glick 2011-10-31 00:54:48 UTC
I am confused about the net effect of this change. Does it effectively revert the fix of bug #161085, as bug #188163 comment #8 vaguely implies, or is there now a third policy?
Comment 9 Jan Lahoda 2011-10-31 11:48:08 UTC
(In reply to comment #8)
> I am confused about the net effect of this change. Does it effectively revert
> the fix of bug #161085, as bug #188163 comment #8 vaguely implies, or is there
> now a third policy?

I do not think it reverts the fix for #161085 for the case reported there (although it might break some projects that use CoS in unsupported circumstances, e.g. resource processing in build.xml). Before #161085, when a (J2SE) project was invoked through CoS, it cleared everything from build/classes, put the "correct" classfiles there, and appended "src" to classpath. That way resources could have been loaded through ClassLoaders from the sources. But, the fix done for #161085 started to keep the resources in the build/classes, but did not care to update them when the resource was updated in the source folder. Which lead to various problems with not updated resources. The patch done for this bug fixes that - when a resource is updated in the source folder, it is copied to build/classes as well.