Skip to content

Commit 618d27d

Browse files
committed
HHH-19846 - Drop JUnit 4 usage
Not converted... * org.hibernate.orm.test.hql.PostgreSQLFunctionSelectClauseTest - registering custom function * org.hibernate.orm.test.hql.PostgreSQLFunctionWhereClauseTest - aux-db-object * org.hibernate.orm.test.id.usertype - type registrations * org.hibernate.orm.test.idgen.enhanced.HiloOptimizerConcurrencyTest - recreation of SF during tests * org.hibernate.orm.test.type.AbstractJavaTimeTypeTest subtypes - crazy parameterization (see org.hibernate.orm.test.tm.InterceptorTransactionTest) * org.hibernate.orm.test.cdi.general.hibernatesearch.extended.HibernateSearchExtendedCdiSupportTest - not sure yet, all the other tests here pass with conversion - shelved for now
1 parent a3ad85d commit 618d27d

File tree

475 files changed

+17947
-21096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

475 files changed

+17947
-21096
lines changed

hibernate-core/src/main/java/org/hibernate/engine/spi/TransactionCompletionCallbacksImplementor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
* @since 7.2
1111
*
1212
* @author Gavin King
13-
*
1413
*/
15-
@Incubating // is this separate interface really needed?
14+
@Incubating
1615
public interface TransactionCompletionCallbacksImplementor extends TransactionCompletionCallbacks {
1716
/**
1817
* Are there any registered before-completion callbacks?

hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ public <R extends Service> void startService(ServiceBinding<R> serviceBinding) {
340340
}
341341
}
342342

343+
@Override
343344
public boolean isActive() {
344345
return active.get();
345346
}

hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryImplementor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ default void close() {
3030
destroy();
3131
}
3232

33+
boolean isActive();
34+
3335
/**
3436
* Release resources
3537
*/

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytoone/ManyToOneMapsIdFlushModeTest.java

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
*/
55
package org.hibernate.orm.test.annotations.manytoone;
66

7-
import java.util.HashSet;
8-
import java.util.Set;
9-
107
import jakarta.persistence.Entity;
118
import jakarta.persistence.FlushModeType;
129
import jakarta.persistence.GeneratedValue;
@@ -15,56 +12,53 @@
1512
import jakarta.persistence.ManyToOne;
1613
import jakarta.persistence.MapsId;
1714
import jakarta.persistence.OneToMany;
18-
19-
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
20-
import org.junit.Test;
21-
22-
import org.hibernate.testing.DialectChecks;
23-
import org.hibernate.testing.RequiresDialectFeature;
15+
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
16+
import org.hibernate.testing.orm.junit.DomainModel;
2417
import org.hibernate.testing.orm.junit.JiraKey;
25-
import org.hibernate.testing.transaction.TransactionUtil;
18+
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
19+
import org.hibernate.testing.orm.junit.SessionFactory;
20+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
21+
import org.junit.jupiter.api.Assertions;
22+
import org.junit.jupiter.api.Test;
2623

27-
import static org.junit.Assert.assertEquals;
28-
import static org.junit.Assert.assertNotNull;
29-
import static org.junit.Assert.assertTrue;
24+
import java.util.HashSet;
25+
import java.util.Set;
3026

3127
/**
3228
* @author Chris Cranford
3329
*/
30+
@SuppressWarnings("JUnitMalformedDeclaration")
3431
@JiraKey(value = "HHH-13044")
35-
@RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
36-
public class ManyToOneMapsIdFlushModeTest extends BaseEntityManagerFunctionalTestCase {
37-
@Override
38-
protected Class<?>[] getAnnotatedClasses() {
39-
return new Class<?>[] { ParentEntity.class, ChildEntity.class };
40-
}
41-
32+
@RequiresDialectFeature(feature= DialectFeatureChecks.SupportsIdentityColumns.class)
33+
@DomainModel(annotatedClasses = { ManyToOneMapsIdFlushModeTest.ParentEntity.class, ManyToOneMapsIdFlushModeTest.ChildEntity.class })
34+
@SessionFactory
35+
public class ManyToOneMapsIdFlushModeTest {
4236
@Test
43-
public void testFlushModeCommitWithMapsIdAndIdentity() {
44-
final ParentEntity parent = TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
45-
entityManager.setFlushMode( FlushModeType.COMMIT );
37+
public void testFlushModeCommitWithMapsIdAndIdentity(SessionFactoryScope factoryScope) {
38+
final ParentEntity parent = factoryScope.fromTransaction( (session) -> {
39+
session.setFlushMode( FlushModeType.COMMIT );
4640

47-
final ParentEntity parentEntity = new ParentEntity();
41+
var parentEntity = new ParentEntity();
4842
parentEntity.setData( "test" );
4943

50-
final ChildEntity childEntity = new ChildEntity();
44+
var childEntity = new ChildEntity();
5145
parentEntity.addChild( childEntity );
5246

53-
entityManager.persist( parentEntity );
54-
entityManager.persist( childEntity );
47+
session.persist( parentEntity );
48+
session.persist( childEntity );
5549

5650
return parentEntity;
5751
} );
5852

59-
TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
60-
final ParentEntity parentEntity = entityManager.find( ParentEntity.class, parent.getId() );
61-
assertNotNull( parentEntity );
62-
assertNotNull( parentEntity.getChildren() );
63-
assertTrue( !parentEntity.getChildren().isEmpty() );
53+
factoryScope.inTransaction( (session) -> {
54+
final ParentEntity parentEntity = session.find( ParentEntity.class, parent.getId() );
55+
Assertions.assertNotNull( parentEntity );
56+
Assertions.assertNotNull( parentEntity.getChildren() );
57+
Assertions.assertFalse( parentEntity.getChildren().isEmpty() );
6458

6559
final ChildEntity childEntity = parentEntity.getChildren().iterator().next();
66-
assertNotNull( childEntity );
67-
assertEquals( parentEntity.getId(), childEntity.getId() );
60+
Assertions.assertNotNull( childEntity );
61+
Assertions.assertEquals( parentEntity.getId(), childEntity.getId() );
6862
} );
6963
}
7064

0 commit comments

Comments
 (0)