Skip to content

Commit 15b79b7

Browse files
marko-bekhtayrodiere
authored andcommitted
HHH-19832 Add a migration note on the changes to @BytecodeEnhanced tests
1 parent 57adab5 commit 15b79b7

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

migration-guide.adoc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,51 @@ Interestingly, this now also aligns with handling for auto-flush events which al
103103
The behavior of `noInterceptor()` for `SharedSessionBuilder` and (the new) `SharedStatelessSessionBuilder` was aligned with the preexisting semantics of this method on `SessionBuilder` and `StatelessSessionBuilder`.
104104
The previous behavior may be recovered by calling `noSessionInterceptorCreation()`.
105105

106+
[[test-util-bytecodeenhanced-engine]]
107+
=== JUnit `BytecodeEnhancedTestEngine`
108+
109+
With this version, `BytecodeEnhancedTestEngine` will be disabled by default.
110+
To be able to run the tests annotated with `@BytecodeEnhanced`, this engine has to be explicitly enabled via a system property:
111+
112+
[source, properties]
113+
----
114+
hibernate.testing.bytecode.enhancement.extension.engine.enabled=true
115+
----
116+
117+
For a Maven-based project this can be done as part of the failsafe/surefire plugin configuration:
118+
119+
[source, xml]
120+
----
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-surefire-plugin</artifactId>
124+
<configuration>
125+
<systemPropertyVariables>
126+
<hibernate.testing.bytecode.enhancement.extension.engine.enabled>true</hibernate.testing.bytecode.enhancement.extension.engine.enabled>
127+
<!-- Any other system properties required by your tests -->
128+
</systemPropertyVariables>
129+
<!-- The rest of the testing plugin configuration -->
130+
<!-- ... -->
131+
</configuration>
132+
</plugin>
133+
----
134+
135+
While for a Gradle-based project this can be done in multiple ways, it essentially comes down to configuring the
136+
link:https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:systemProperties[`systemProperties`]
137+
of a `Test` task:
138+
139+
[source, groovy]
140+
----
141+
tasks.withType(Test.class) {
142+
// Enable bytecode enhanced engine:
143+
systemProperties.systemProperties['hibernate.testing.bytecode.enhancement.extension.engine.enabled'] = true
144+
// Any other test task configurations
145+
// ...
146+
}
147+
----
148+
149+
Also, this engine is expected to only work with the exact version of JUnit that `org.hibernate.orm:hibernate-testing` depends on.
150+
While it may work with other versions as well, there is no guarantee of that.
106151

107152
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108153
// DDL changes
@@ -120,3 +165,9 @@ Such changes typically do not impact programs using a relational schema managed
120165

121166
This section describes changes to dependencies used by Hibernate ORM.
122167

168+
[[junit6]]
169+
=== JUnit 6 update
170+
171+
Hibernate ORM test utils distributed as `org.hibernate.orm:hibernate-testing` are now based on JUnit 6.0.
172+
In general, this update is compatible with previous JUnit 5 versions unless the tests depended on the
173+
<<test-util-bytecodeenhanced-engine,@BytecodeEnhanced extension>>.

0 commit comments

Comments
 (0)