|
4 | 4 | */
|
5 | 5 | package org.hibernate.orm.test.connections;
|
6 | 6 |
|
| 7 | +import org.hibernate.Session; |
| 8 | +import org.hibernate.engine.spi.SessionFactoryImplementor; |
| 9 | +import org.hibernate.testing.orm.junit.DomainModel; |
| 10 | +import org.hibernate.testing.orm.junit.ServiceRegistry; |
| 11 | +import org.hibernate.testing.orm.junit.SessionFactory; |
| 12 | +import org.hibernate.testing.orm.junit.SessionFactoryScope; |
| 13 | +import org.hibernate.testing.orm.junit.Setting; |
| 14 | +import org.junit.jupiter.api.Test; |
| 15 | + |
7 | 16 | import java.sql.Blob;
|
8 | 17 | import java.sql.Clob;
|
9 | 18 | import java.sql.SQLException;
|
10 | 19 |
|
11 |
| -import org.junit.Test; |
12 |
| - |
13 |
| -import org.hibernate.Session; |
14 |
| -import org.hibernate.cfg.Configuration; |
15 |
| -import org.hibernate.cfg.Environment; |
16 |
| -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; |
17 |
| - |
18 |
| -import static org.junit.Assert.assertFalse; |
| 20 | +import static org.hibernate.cfg.AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS; |
| 21 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
19 | 22 |
|
20 | 23 | /**
|
21 | 24 | * Test originally developed to verify and fix HHH-5550
|
22 | 25 | *
|
23 | 26 | * @author Steve Ebersole
|
24 | 27 | */
|
25 |
| -public class HibernateCreateBlobFailedCase extends BaseCoreFunctionalTestCase { |
26 |
| - |
27 |
| - @Override |
28 |
| - protected String getBaseForMappings() { |
29 |
| - return "org/hibernate/orm/test/"; |
30 |
| - } |
31 |
| - |
32 |
| - @Override |
33 |
| - public String[] getMappings() { |
34 |
| - return new String[] { "connections/Silly.hbm.xml" }; |
35 |
| - } |
36 |
| - |
37 |
| - @Override |
38 |
| - public void configure(Configuration cfg) { |
39 |
| - super.configure( cfg ); |
40 |
| - cfg.setProperty( Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread" ); |
41 |
| - } |
| 28 | +@SuppressWarnings("JUnitMalformedDeclaration") |
| 29 | +@ServiceRegistry(settings = @Setting( name=CURRENT_SESSION_CONTEXT_CLASS, value = "thread")) |
| 30 | +@DomainModel(annotatedClasses = { Silly.class, Other.class }) |
| 31 | +@SessionFactory |
| 32 | +public class HibernateCreateBlobFailedCase { |
42 | 33 |
|
43 | 34 | @Test
|
44 |
| - public void testLobCreation() throws SQLException { |
45 |
| - Session session = sessionFactory().getCurrentSession(); |
| 35 | + public void testLobCreation(SessionFactoryScope factoryScope) throws SQLException { |
| 36 | + final SessionFactoryImplementor sessionFactory = factoryScope.getSessionFactory(); |
| 37 | + Session session = sessionFactory.getCurrentSession(); |
46 | 38 | session.beginTransaction();
|
47 | 39 | Blob blob = session.getLobHelper().createBlob( new byte[] {} );
|
48 | 40 | blob.free();
|
|
0 commit comments