mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-07 11:48:18 +00:00
HHH-17019 Move tests to bytecode folder
This commit is contained in:
parent
c971b16e14
commit
1b1ed23964
@ -4,9 +4,7 @@
|
|||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.test.jpa.callbacks;
|
package org.hibernate.orm.test.bytecode.enhancement.callbacks;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -26,6 +24,8 @@
|
|||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.PostLoad;
|
import jakarta.persistence.PostLoad;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
@JiraKey("HHH-17019")
|
@JiraKey("HHH-17019")
|
||||||
@RunWith(BytecodeEnhancerRunner.class)
|
@RunWith(BytecodeEnhancerRunner.class)
|
||||||
public class PostLoadLazyListenerTest extends BaseCoreFunctionalTestCase {
|
public class PostLoadLazyListenerTest extends BaseCoreFunctionalTestCase {
|
||||||
@ -46,7 +46,8 @@ public void tearDown() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void smoke() {
|
public void smoke() {
|
||||||
inTransaction( session -> {
|
inTransaction(
|
||||||
|
session -> {
|
||||||
Person person = new Person( 1, "name" );
|
Person person = new Person( 1, "name" );
|
||||||
Tag tag = new Tag( 100, person );
|
Tag tag = new Tag( 100, person );
|
||||||
person.tags.add( tag );
|
person.tags.add( tag );
|
||||||
@ -56,10 +57,14 @@ public void smoke() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
inTransaction( session -> {
|
inTransaction(
|
||||||
|
session -> {
|
||||||
Tag tag = session.find( Tag.class, 100 );
|
Tag tag = session.find( Tag.class, 100 );
|
||||||
assertThat( tag )
|
assertThat( tag )
|
||||||
.isNotNull();
|
.isNotNull();
|
||||||
|
assertThat( TagListener.WAS_CALLED ).isTrue();
|
||||||
|
assertThat( PersonListener.WAS_CALLED ).isFalse();
|
||||||
|
|
||||||
assertThat( tag.person.name ).isEqualTo( "name" );
|
assertThat( tag.person.name ).isEqualTo( "name" );
|
||||||
assertThat( PersonListener.WAS_CALLED ).isTrue();
|
assertThat( PersonListener.WAS_CALLED ).isTrue();
|
||||||
}
|
}
|
||||||
@ -87,6 +92,7 @@ public Person(int id, String name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Tag")
|
@Entity(name = "Tag")
|
||||||
|
@EntityListeners(TagListener.class)
|
||||||
public static class Tag {
|
public static class Tag {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@ -112,4 +118,13 @@ void onPreUpdate(Object o) {
|
|||||||
WAS_CALLED = true;
|
WAS_CALLED = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TagListener {
|
||||||
|
static boolean WAS_CALLED = false;
|
||||||
|
|
||||||
|
@PostLoad
|
||||||
|
void onPreUpdate(Object o) {
|
||||||
|
WAS_CALLED = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.test.jpa.callbacks;
|
package org.hibernate.orm.test.bytecode.enhancement.callbacks;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -22,8 +22,8 @@
|
|||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
|
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
|
||||||
|
import org.hibernate.testing.orm.junit.JiraKey;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
|
||||||
@TestForIssue(jiraKey = "HHH-12718")
|
@JiraKey("HHH-12718")
|
||||||
@RunWith(BytecodeEnhancerRunner.class)
|
@RunWith(BytecodeEnhancerRunner.class)
|
||||||
public class PreUpdateBytecodeEnhancementTest extends BaseEntityManagerFunctionalTestCase {
|
public class PreUpdateBytecodeEnhancementTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user