Hello.
I think these 6 tests is incorrect.
Example: testVersionedReadWrite()
In this test we store one document 2 times with different data, load 1st
version and get version list (versions var.) of documents.
I think versions.length should be 2, but in test:
assertTrue(1==versions.length);
I look why it is work in hibernate (in my XWikiJcrStore versions.length==2)
and found, what versioning updates in saveXWikiDoc run before setting
database : doc.setDatabase(context.getDatabase());
And versioning cache (XWikiContext.get/set DocumentArchive) storing at
key with default database 'xwiki', instead of 'xwikitest'
Because of it first saveXWikiDoc call storing in versioning cache by key
'xwiki:Main.WebHome', second - 'xwikitest:Main.WebHome'
Next, XWikiHibernateVersioningStore.loadXWikiDoc don't set database to
document. And XWikiHibernateVersioningStore.getXWikiDocVersions look at
wrong cache key 'xwiki:Main.WebHome' with only 1 document version.
If this is right, i offer:
XWikiHibernateStore.saveXWikiDoc:
move doc.setDatabase(context.getDatabase()); to begin
XWikiHibernateVersioningStore.loadXWikiDoc:
do doc.setDatabase(basedoc.getDatabase());
StoreTest.versionedReadWrite:
assertEquals(2, versions.length);
With these changes StoreTest passed.
I can commit this with you agree.
--
Artem Melentyev, UralSU, CS401.