[Hibernate-JIRA] Created: (HSEARCH-931) CollectionUpdateEventTest fails from the commans line when run after a unit test which extends JPATestcase
by Hardy Ferentschik (JIRA)
CollectionUpdateEventTest fails from the commans line when run after a unit test which extends JPATestcase
----------------------------------------------------------------------------------------------------------
Key: HSEARCH-931
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-931
Project: Hibernate Search
Issue Type: Bug
Components: tests
Affects Versions: 4.0.0.Beta2
Reporter: Hardy Ferentschik
Fix For: 4.0.0.CR1
The first problem was that we could not reproduce the problem and that was due to the fact that the execution order of tests varies depending on the OS. The surefire plugin has the _runOrder_ property to define the order. The default is _filesystem_ which has different results on Mac vs Linux. On Mac the tests are run in alphabetical order on Linux in "random" order.
If the tests are ordered alphabetically JPA tests are run after _CollectionUpdateEventTest_ and all works fine. If the order is random and a JPA test runs first we get the following error:
{noformat}
-------------------------------------------------------------------------------
Test set: org.hibernate.search.test.engine.optimizations.CollectionUpdateEventTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.574 sec <<< FAILURE!
testWithClassBridge(org.hibernate.search.test.engine.optimizations.CollectionUpdateEventTest) Time elapsed: 0.242 sec <<< FAILURE!
org.junit.ComparisonFailure: [catalogItems should have been initialized] expected:<[tru]e> but was:<[fals]e>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.fest.assertions.ConstructorInvoker.newInstance(ConstructorInvoker.java:36)
at org.fest.assertions.ComparisonFailureFactory.newComparisonFailure(ComparisonFailureFactory.java:60)
at org.fest.assertions.ComparisonFailureFactory.comparisonFailure(ComparisonFailureFactory.java:46)
at org.fest.assertions.Fail.comparisonFailed(Fail.java:83)
at org.fest.assertions.Fail.failIfNotEqual(Fail.java:71)
at org.fest.assertions.GenericAssert.isEqualTo(GenericAssert.java:217)
at org.fest.assertions.BooleanAssert.isEqualTo(BooleanAssert.java:73)
at org.fest.assertions.BooleanAssert.isTrue(BooleanAssert.java:55)
at org.hibernate.search.test.engine.optimizations.CollectionUpdateEventTest.testScenario(CollectionUpdateEventTest.java:98)
at org.hibernate.search.test.engine.optimizations.CollectionUpdateEventTest.testWithClassBridge(CollectionUpdateEventTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
{noformat}
At the moment we explicitly set the _runOrder_ option in the surefire plugin to _alphabetical_ which will make the tests pass. To trigger the failure you can change _runOrder_ to _reversealphabetical_ and run:
{code}
mvn test -Dtest=org.hibernate.search.test.engine.optimizations.CollectionUpdateEventTest,EntityManagerTest
{code}
Also important for this issue is that the surefire plugin is configured to only fork _once_ for all tests, so the same JVM is shared between tests.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months
[Hibernate-JIRA] Created: (HHH-6724) AnnotationBinder and HbmBinder improperly set EntityPersisterClass upon class hierarchy
by Emmanuel Bernard (JIRA)
AnnotationBinder and HbmBinder improperly set EntityPersisterClass upon class hierarchy
---------------------------------------------------------------------------------------
Key: HHH-6724
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6724
Project: Hibernate Core
Issue Type: Bug
Components: metamodel
Affects Versions: 4.0.0.CR4
Reporter: Emmanuel Bernard
Assignee: Emmanuel Bernard
Fix For: 4.0.0.next
In Hibernate Core 3.6, PersisterClassProvider (the father of PersisterClassResolver) was called before the Binder phase could set any default value (in particular in the inheritance case). This was done in EntityBinder.bindEntity() if @Persister was not explicitly set.
In Hibernate Core 4, such calls to PersisterClassResolver are done in PersisterFactoryImpl#createEntityPersister. This is after the Binder phase which sets persister values when mapping a class hierarchy (AnnotationBinder#bindClass line 608, 631 and 651).
Hibernate OGM is not given opportunity to override the value.
A fix for this involves not setting PersistentClass#setEntityPersisterClass in the Binders (unless explicitly set) and move the class hierarchy decision logic to PersisterClassResolver. Note that the initial PersisterClassResolver implementation was incomplete.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months