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 112433 - SourcePathImplAddonsTest fails
Summary: SourcePathImplAddonsTest fails
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Konecny
URL:
Keywords: RANDOM, TEST
Depends on:
Blocks:
 
Reported: 2007-08-09 12:24 UTC by Andrei Badea
Modified: 2009-07-28 10:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Log (7.12 KB, text/html)
2007-08-09 12:25 UTC, Andrei Badea
Details
Patch for SourcePathImplAddonsTest (6.31 KB, application/octet-stream)
2007-08-10 23:52 UTC, _ gmpatil
Details
Log of fails of testAddonsCreateSourceRoot and testAddonsRemoveSourceRoot (9.10 KB, text/plain)
2007-10-08 14:01 UTC, Andrei Badea
Details
SourcePathImplAddonsTestCDL.diff (5.85 KB, application/octet-stream)
2007-10-08 23:57 UTC, _ gmpatil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2007-08-09 12:24:33 UTC
... in the 200708080000 build.
Comment 1 Andrei Badea 2007-08-09 12:25:28 UTC
Created attachment 46396 [details]
Log
Comment 2 _ gmpatil 2007-08-09 22:11:17 UTC
I was not able to simulate the failure on Windows XP Professional running on Intel(R) Xeon(R) CPU at 1.9 Ghz.

I was able to simulate roughly 50% time after commenting the 1 second sleep at line 261.

My guess is it is related to the slower system and/or load on the system.

If it happens frequently on the test machine we can try by increasing the sleep time to 2 seconds at line 261.
Comment 3 Andrei Badea 2007-08-10 10:02:01 UTC
Any sleep() calls in tests are likely to make the tests brittle. Please reconsider the need for the sleep() calls (and
the need to do work in a RP thread in SourcePathImplementation, which I guess is why sleep() is needed). 

If you are sure you need the RP, consider adding a listener to "cp" and waiting for an entries event to be fired before
asserting that "cp" contains the URLs.
Comment 4 _ gmpatil 2007-08-10 23:51:12 UTC
I agree removing RP thread will eliminate the need to have Sleep in test code. But I think it is better existing code
not to block other FileChangeListeners' till our task is finished. Blocking might create performance issues especially
file node refreshing on slower machine.

I have attached the patch, which uses listener on "cp" .
Comment 5 _ gmpatil 2007-08-10 23:52:56 UTC
Created attachment 46470 [details]
Patch for SourcePathImplAddonsTest
Comment 6 Andrei Badea 2007-09-14 15:08:35 UTC
In the spirit on Donald Knuth's "premature optimization is the root of all evil" I'd like to ask if you have any numbers
to support the performance issues.

A few comments on the patch:

- setGotCPChangeEvent() and getGotCPChangeEvent() belong in SourceClassPathListener.

- moreover, you can get rid of them and the waiting code in createAndWaitForEvent() by using CountDownLatch. You create
a CDL initialized to 1, call await() on in instead of the waiting code and countDown() instead of setGotCPChangeEvent().
Comment 7 Andrei Badea 2007-10-08 14:01:32 UTC
Created attachment 50380 [details]
Log of fails of testAddonsCreateSourceRoot and testAddonsRemoveSourceRoot
Comment 8 _ gmpatil 2007-10-08 23:54:19 UTC
Attached patch uses Java 5 CDL, instead custom code.
Comment 9 _ gmpatil 2007-10-08 23:57:12 UTC
Created attachment 50452 [details]
SourcePathImplAddonsTestCDL.diff
Comment 10 Tomas Mysik 2008-01-22 09:41:04 UTC
Any progress here? Thanks.
Comment 11 _ gmpatil 2008-01-22 22:29:43 UTC
Earlier thinking was I will check-in the 'SourcePathImplAddonsTestCDL.diff' changes if it was Ok with module owners.

Will have to verify again the changes in the light of FileObject related changes as discussed in the below thread.
http://www.netbeans.org/servlets/BrowseList?list=nbdev&by=thread&from=827178
Comment 12 Andrey Yamkovoy 2009-07-28 10:27:29 UTC
Since the test is stable and pass looks like it was fixed.