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 155444

Summary: Commit validation tests should (optionally?) fail if unexpected exception raised
Product: platform Reporter: _ tboudreau <tboudreau>
Component: NB JUnitAssignee: apireviews <apireviews>
Status: RESOLVED FIXED    
Severity: blocker CC: jglick, jtulach
Priority: P3 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 160554    
Bug Blocks:    
Attachments: Proposed patch, please review

Description _ tboudreau 2008-12-15 03:43:45 UTC
See discussion here in issue 152249 - for some time commit validation would present a series of exception dialogs, yet pass.  Probably it should not pass if a 
change causes some code that is run by one of the tests to throw an exception.
Comment 2 Jesse Glick 2008-12-16 14:06:29 UTC
jtulach suggests:

- add NbModuleSuite.Configuration.failOnException(Level.INFORMATIONAL).failOnLogMessage(Level.SEVERE)

- use these methods in ide.kit/**/IDEValidation.java
Comment 3 Jaroslav Tulach 2009-03-12 14:00:20 UTC
I seem to need this functionality.
Comment 4 Jaroslav Tulach 2009-03-12 14:02:12 UTC
Created attachment 78117 [details]
Proposed patch, please review
Comment 5 _ tboudreau 2009-03-12 17:27:03 UTC
Strongly suggest adding an item to the developer FAQ about how to use this option once it is integrated:
http://wiki.netbeans.org/NetBeansDeveloperFAQ
Comment 6 Jesse Glick 2009-03-13 02:21:19 UTC
I guess your patch omits some NbModuleLogHandler.java? (hg addrem) The API looks fine to me.
Comment 7 Jaroslav Tulach 2009-03-13 14:08:53 UTC
This is more or less the code that I want to integrate:
http://hg.netbeans.org/ergonomics/rev/4d394a5c7c7a
Comment 8 Jesse Glick 2009-03-13 15:03:54 UTC
Shouldn't NbEvents read

  logger.log(warn ? Level.WARNING : Level.INFO, text + "\n");

?

Irritating that Level is not Comparable<Level>. I will file a JRE RFE when I get a chance.
Comment 10 Jesse Glick 2011-11-04 22:10:14 UTC
This does not seem to work very reliably, at least from Maven (if it matters). 7.1 Beta always prints a warning to console even in a plain Platform app:

WARNING [org.netbeans.TopSecurityManager]: use of system property netbeans.home has been obsoleted in favor of InstalledFileLocator at org.netbeans.core.startup.CLIOptions.getUserDir(CLIOptions.java:294)

(This is since fixed in trunk.) But

return NbModuleSuite.createConfiguration(...).
        gui(false).
        failOnMessage(Level.WARNING).
        failOnException(Level.INFO).
        suite();

does not consistently fail; the warning is displayed in test output but the suite passes anyway.

Putting a Thread.sleep(5000) in a test method does not help. Putting Exceptions.printStackTrace(new Exception()) in a test method usually makes it fail, but not consistently. Using gui(true) and doing some operations with jellytools.platform seems to make it fail consistently.

Not sure what the problem is, but I am guessing it has something to do with buffering in TopLogging.