| Summary: | TEST: fieldaccess tests should never use "default" pu | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Andrei Ilitchev <andrei.ilitchev> | ||||||||
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> | ||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | michael.f.obrien | ||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 186231 [details]
Suggested patch.
The patch enforces fieldaccess tests never using "default" pu - always using "fieldaccess" instead (easily verifyable by creating a conditional break point in createEMF method).
1. For now just made sure that "fieldaccess" argument is always passed when it should (didn't attempt refactoring all the methods to use getPersistenceUnitName() instead of "default").
2. Moved feildaccess.relationships/** from eclipselink-annotation-model.jar to eclipselink-advanced-field-access-model.jar;
3. fieldaccess.relationships.VirtualAttributeTestSuite is no longer used - currently it's an exact copy of relationships.VirtualAttributeTestSuite. To use this test suite smbd has to define fieldaccess entities for it.
Created attachment 186282 [details]
Suggested patch - reposted.
Created attachment 186288 [details]
updated patch
The patch updated according to feedback received from Tom, Edwin and Yiping:
1. CompositeEnumerationTest removed from the patch;
2. fieldaccess.relationships.VirtualAttributeTestSuite deleted - only makes sense for method access;
3. In build.xml "server-test-fieldaccess-relationships" should now use "fieldaccess" pu (was "default");
4. Move from all persistence.xml (that includes osgi, spring...) the property
<property name="eclipselink.cache.shared.org.eclipse.persistence.testing.models.jpa.fieldaccess.relationships.IsolatedItem" value="false"/>
into the corresponding persistence.xml for "fielsaccess".
Checked into trunk. Reviewed by Tom, Edwin and Yiping. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
It's a purely testing bug: lots of jpa.fieldaccess tests use "default" pu instaed of "fieldaccess". It primarily happens because there are lots of test methods that - unless given puName - use "default" pu. More commonly used methods are: createEntityManager, getServerSession, clearCache. but there is a bunch of other methods, too: doesEntityManagerFactoryExist, getDbPlatform, getEntityManagerFactory, isWeavingEnabled, isPessimisticWriteLockSupported, isSelectForUpateNoWaitSupported, supportsStoredProcedures, verifyDelete, verifyObjectInCacheAndDatabase, verifyObjectInEntityManager, ...? To resolve the problem once and for all, all the methods should call getPersistenceUnitName method instaed of using "default" (some already do) - that would allow a TestSuite to specify its persistence unit - and then always call "defaulting" versions of the methods above. I.e., define String getPersistenceUnit() { return "fieldaccess"; } and boldly use createEntityManager() or getServerSession() instead of: createEntityManager("fieldaccess") or getServerSession("fieldaccess")