Skip to content

Commit 2558f98

Browse files
committed
HHH-17746 update tests to use streamlined API
1 parent e732cdd commit 2558f98

File tree

114 files changed

+221
-203
lines changed

Some content is hidden

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

114 files changed

+221
-203
lines changed

hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/OracleSQLCallableStatementProxyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class OracleSQLCallableStatementProxyTest extends
3737
protected void configure(Configuration configuration) {
3838
configuration.setProperty(
3939
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
40-
C3P0ConnectionProvider.class.getName()
40+
C3P0ConnectionProvider.class
4141
);
4242
}
4343

hibernate-core/src/test/java/org/hibernate/engine/jdbc/env/internal/SkipLoadingSequenceInformationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public class SkipLoadingSequenceInformationTest extends BaseCoreFunctionalTestCa
3434

3535
@Override
3636
protected void configure(Configuration configuration) {
37-
configuration.setProperty( AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, SequenceMismatchStrategy.NONE.name() );
38-
configuration.setProperty( Environment.DIALECT, VetoingDialect.class.getName() );
37+
configuration.setProperty( AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, SequenceMismatchStrategy.NONE );
38+
configuration.setProperty( Environment.DIALECT, VetoingDialect.class );
3939
}
4040

4141
@Entity(name="seqentity")

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/beanvalidation/BeanValidationAutoTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.math.BigDecimal;
1010
import jakarta.validation.ConstraintViolationException;
1111

12+
import org.hibernate.boot.beanvalidation.ValidationMode;
1213
import org.junit.Test;
1314

1415
import org.hibernate.Session;
@@ -17,6 +18,7 @@
1718

1819
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
1920

21+
import static org.hibernate.cfg.ValidationSettings.JAKARTA_VALIDATION_MODE;
2022
import static org.junit.Assert.assertEquals;
2123
import static org.junit.Assert.fail;
2224

@@ -45,7 +47,7 @@ public void testListeners() {
4547
@Override
4648
protected void configure(Configuration cfg) {
4749
super.configure( cfg );
48-
cfg.setProperty( "jakarta.persistence.validation.mode", "AUTO" );
50+
cfg.setProperty( JAKARTA_VALIDATION_MODE, ValidationMode.AUTO );
4951
}
5052

5153
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/beanvalidation/BeanValidationProvidedFactoryTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
import jakarta.validation.Validation;
1414
import jakarta.validation.ValidatorFactory;
1515

16+
import org.hibernate.boot.beanvalidation.ValidationMode;
1617
import org.junit.Test;
1718

1819
import org.hibernate.Session;
1920
import org.hibernate.Transaction;
2021
import org.hibernate.cfg.Configuration;
2122
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
2223

24+
import static org.hibernate.cfg.ValidationSettings.JAKARTA_VALIDATION_FACTORY;
25+
import static org.hibernate.cfg.ValidationSettings.JAKARTA_VALIDATION_MODE;
2326
import static org.junit.Assert.assertEquals;
2427
import static org.junit.Assert.fail;
2528

@@ -69,7 +72,7 @@ public String interpolate(String s, Context context, Locale locale) {
6972
final jakarta.validation.Configuration<?> configuration = Validation.byDefaultProvider().configure();
7073
configuration.messageInterpolator( messageInterpolator );
7174
ValidatorFactory vf = configuration.buildValidatorFactory();
72-
cfg.getProperties().put( "jakarta.persistence.validation.factory", vf );
73-
cfg.setProperty( "jakarta.persistence.validation.mode", "AUTO" );
75+
cfg.getProperties().put( JAKARTA_VALIDATION_FACTORY, vf );
76+
cfg.setProperty( JAKARTA_VALIDATION_MODE, ValidationMode.AUTO );
7477
}
7578
}

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/beanvalidation/HibernateTraversableResolverTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
import jakarta.validation.ConstraintViolation;
1111
import jakarta.validation.ConstraintViolationException;
1212

13+
import org.hibernate.boot.beanvalidation.ValidationMode;
1314
import org.junit.Test;
1415

1516
import org.hibernate.Session;
1617
import org.hibernate.Transaction;
1718
import org.hibernate.cfg.Configuration;
1819
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
1920

21+
import static org.hibernate.cfg.ValidationSettings.JAKARTA_VALIDATION_MODE;
2022
import static org.junit.Assert.assertEquals;
2123
import static org.junit.Assert.fail;
2224

@@ -193,7 +195,7 @@ public void testAssocInEmbeddedNotValidated() {
193195
@Override
194196
protected void configure(Configuration cfg) {
195197
super.configure( cfg );
196-
cfg.setProperty( "jakarta.persistence.validation.mode", "AUTO" );
198+
cfg.setProperty( JAKARTA_VALIDATION_MODE, ValidationMode.AUTO );
197199
}
198200

199201
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/beanvalidation/MergeNotNullCollectionTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
import org.hibernate.Session;
2121
import org.hibernate.Transaction;
2222

23+
import org.hibernate.boot.beanvalidation.ValidationMode;
2324
import org.hibernate.cfg.Configuration;
2425
import org.hibernate.testing.TestForIssue;
2526
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
2627
import org.junit.Test;
2728

29+
import static org.hibernate.cfg.ValidationSettings.JAKARTA_VALIDATION_MODE;
30+
2831
/**
2932
* @author Ryan Emerson
3033
*/
@@ -39,7 +42,7 @@ protected Class<?>[] getAnnotatedClasses() {
3942
@Override
4043
protected void configure(Configuration cfg) {
4144
super.configure( cfg );
42-
cfg.setProperty( "jakarta.persistence.validation.mode", "AUTO" );
45+
cfg.setProperty( JAKARTA_VALIDATION_MODE, ValidationMode.AUTO );
4346
}
4447

4548
@Test

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/beanvalidation/MergeNotNullCollectionUsingIdentityTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import jakarta.validation.ConstraintViolationException;
2020
import jakarta.validation.constraints.NotNull;
2121

22+
import org.hibernate.boot.beanvalidation.ValidationMode;
2223
import org.junit.Test;
2324

2425
import org.hibernate.Session;
@@ -30,6 +31,8 @@
3031
import org.hibernate.testing.TestForIssue;
3132
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
3233

34+
import static org.hibernate.cfg.ValidationSettings.JAKARTA_VALIDATION_MODE;
35+
3336
/**
3437
* @author Ryan Emerson
3538
*/
@@ -48,7 +51,7 @@ protected Class<?>[] getAnnotatedClasses() {
4851
@Override
4952
protected void configure(Configuration cfg) {
5053
super.configure( cfg );
51-
cfg.setProperty( "jakarta.persistence.validation.mode", "AUTO" );
54+
cfg.setProperty( JAKARTA_VALIDATION_MODE, ValidationMode.AUTO );
5255
}
5356

5457
@Test

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/embeddables/EmbeddableIntegratorTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.hibernate.Session;
1616
import org.hibernate.SessionFactory;
1717
import org.hibernate.cfg.Configuration;
18+
import org.hibernate.cfg.Environment;
1819
import org.hibernate.dialect.H2Dialect;
1920

2021
import org.hibernate.testing.orm.junit.BaseUnitTest;
@@ -41,7 +42,7 @@ public class EmbeddableIntegratorTest {
4142
@Test
4243
public void testWithoutIntegrator() {
4344
final Configuration cfg = new Configuration().addAnnotatedClass( Investor.class )
44-
.setProperty( "hibernate.hbm2ddl.auto", "create-drop" );
45+
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
4546
ServiceRegistryUtil.applySettings( cfg.getStandardServiceRegistryBuilder() );
4647
try (SessionFactory sf = cfg.buildSessionFactory()) {
4748
Session sess = sf.openSession();
@@ -76,7 +77,7 @@ public void testWithoutIntegrator() {
7677
public void testWithTypeContributor() {
7778
final Configuration cfg = new Configuration().addAnnotatedClass( Investor.class )
7879
.registerTypeContributor( new InvestorTypeContributor() )
79-
.setProperty( "hibernate.hbm2ddl.auto", "create-drop" );
80+
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
8081
ServiceRegistryUtil.applySettings( cfg.getStandardServiceRegistryBuilder() );
8182
try (SessionFactory sf = cfg.buildSessionFactory(); Session sess = sf.openSession()) {
8283
try {

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/ImageTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ImageTest extends BaseCoreFunctionalTestCase {
3535
@Override
3636
protected void configure(Configuration configuration) {
3737
super.configure( configuration );
38-
configuration.setProperty( AvailableSettings.WRAPPER_ARRAY_HANDLING, WrapperArrayHandling.ALLOW.name() );
38+
configuration.setProperty( AvailableSettings.WRAPPER_ARRAY_HANDLING, WrapperArrayHandling.ALLOW );
3939
}
4040

4141
@Test

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/ManyToManyMaxFetchDepth0Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class ManyToManyMaxFetchDepth0Test extends ManyToManyTest {
1919
@Override
2020
protected void configure(Configuration cfg) {
21-
cfg.setProperty( Environment.MAX_FETCH_DEPTH, "0" );
21+
cfg.setProperty( Environment.MAX_FETCH_DEPTH, 0 );
2222
super.configure( cfg );
2323
}
2424
}

0 commit comments

Comments
 (0)