Hi Florian, I'm using JUnit 3.8.2, Oracle JDK 1.7.0_05, Ubuntu 12.04-64 bit against the current JSPWiki trunk.

I submitted a patch here: https://issues.apache.org/jira/browse/JSPWIKI-665, but it ends up breaking another test case within the same class (as described in that JIRA.)

The main problem is that the PageViewPlugin doesn't appear to erase its count for a page when a Wiki page is deleted, hence it reuses the same page counts it has in memory when that page is recreated in another test case. Hence tests will fail if JUnit runs them in a different order on JDK 7 than it does on JDK 6, because the page counts you're testing for will be different. I couldn't see an immediate solution to it, somehow the WikiEngine needs to send notifications to the PVP whenever a page is deleted so the PVP can remove that page and its associated count from its in-memory database. Further, saves to the text may require a similar notification, because if you have the [PageViewPlugin] defined on the first save, the page will go to the PVP's database, but if you subsequently remove that tag and re-save the page you'll want to remove that entry from the PVP database. An alternative solution that could work for all plugins might be to have a public WikiEngine broadcastPageList() method that can be externally called (say, within the tearDown() method of the JUnit test class). It would provide a list of all its current pages in memory to any plugin listening for it, and each plugin can then go through its database, removing no-longer-existing pages.

Regards,
Glen

On 10/28/2012 03:18 AM, Florian Holeczek wrote:
Hi Glen,

the most interesting part is why there is a difference to Oracle/Sun JDK 6, 
which I've always been using without any problems so far (under Linux x86-64).
I'll try to reproduce it later this day.
Which exact version are you using? I remember the first versions to have a bug, 
something like a too aggressive bytecode compiler having modified the semantics 
of the code... AFAIR the Lucene project detected this flaw.

Regards
  Florian

Reply via email to