[rfc][icedtea-web][policyeditor] Unit tests fix after last PolicyEditor async IO patch

Andrew Azores aazores at redhat.com
Mon Jun 2 21:07:49 UTC 2014


Hi,

There's a race between the unit tests and PolicyEditor instances that is 
causing several PolicyEditor tests to sporadically fail, due to the 
tests asserting certain conditions about the contents of the policy file 
model before it has actually been opened and parsed. This patch fixes 
the race by adding a "performingIO" field to the editor, which is simply 
marked true immediately before starting an IO operation and marked false 
immediately after completing it. The test cases then poll the editor 
every 50ms, waiting for it to complete its IO, before performing the 
actual tests.

Additionally, the new progress bar dialog which appears during blocking 
IO does so assuming that the editor panel is contained within some 
window, which it uses as its parent to set its modality and to center 
itself. However, this is not necessarily the case - PolicyEditor can 
actually be used headless, and is used headless during the unit tests. 
The dialog appears during the unit tests regardless of the fact that 
there is no parent window. This is solved by simply checking if the 
parent window of the editor panel is null, and if it is, not invoking 
the Runnable which displays the progress indicator.

Thanks,

-- 
Andrew A

-------------- next part --------------
A non-text attachment was scrubbed...
Name: policyeditor-async-tests.patch
Type: text/x-patch
Size: 5167 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20140602/e2d5c1cc/policyeditor-async-tests.patch>


More information about the distro-pkg-dev mailing list